Skip to content

Commit

Permalink
Merge pull request marko-js#714 from marko-js/revert-708-705-dynamic-…
Browse files Browse the repository at this point in the history
…root-id-attr

Revert "Fixes marko-js#705 - Throw error when the root HTML element has a dynamic id …"
  • Loading branch information
austinkelleher authored Jun 1, 2017
2 parents 4eb2047 + a998535 commit 5d6b4e3
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 21 deletions.
9 changes: 1 addition & 8 deletions src/components/taglib/TransformHelper/handleRootNodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,16 +199,9 @@ module.exports = function handleRootNodes() {
hasLegacyExplicitBind = true;
} else {
if (node.hasAttribute('id')) {
let id = node.getAttributeValue('id');

if (id && id.type !== 'Literal') {
context.addError('Root HTML element should not have a dynamic `id` attribute. See: https://github.com/marko-js/marko/wiki/Error:-Dynamic-root-HTML-element-id-attribute');
return;
}

hasIdCount++;
nodeWithAssignedId = node;
assignedId = id;
assignedId = node.getAttributeValue('id');
}

if (tagName === 'style') {
Expand Down

This file was deleted.

6 changes: 0 additions & 6 deletions test/autotests/render/error-variable-id-root-node/test.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
<div><div style="color: red;" id="foo-Frank">Hello Frank!</div></div>
<div style="color: red;" id="foo-Frank">Hello Frank!</div>
5 changes: 2 additions & 3 deletions test/autotests/render/shorthand-div-id-dynamic/template.marko
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
div
div#foo-${input.name} style="color: red;"
-- Hello ${input.name}!
div#foo-${input.name} style="color: red;"
-- Hello ${input.name}!

0 comments on commit 5d6b4e3

Please sign in to comment.