Revert "Fixes #705 - Throw error when the root HTML element has a dynamic id …"

This commit is contained in:
Austin Kelleher 2017-06-01 16:12:09 -04:00 committed by GitHub
parent 4eb20477a2
commit a998535db7
5 changed files with 4 additions and 21 deletions

View File

@ -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') {

View File

@ -1,3 +0,0 @@
$ var id = 'abc123';
<div id=id/>

View File

@ -1,6 +0,0 @@
var expect = require('chai').expect;
exports.checkError = function(e) {
var message = e.toString();
expect(message).to.contain('https://github.com/marko-js/marko/wiki/Error:-Dynamic-root-HTML-element-id-attribute');
};

View File

@ -1 +1 @@
<div><div style="color: red;" id="foo-Frank">Hello Frank!</div></div>
<div style="color: red;" id="foo-Frank">Hello Frank!</div>

View File

@ -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}!