web-components-examples
web-components-examples copied to clipboard
popup-info-box-web-component violates HTML spec
The spec says this:
The element's attributes and children must not be inspected, as in the non-upgrade case none will be present, and relying on upgrades makes the element less usable.
The popup-info-box-web-component example violates this! See https://github.com/mdn/web-components-examples/blob/master/popup-info-box-web-component/main.js#L22
The example still works because the script is loaded with defer
. However, it doesn't work if you do something like this:
const elem = document.createElement('popup-info');
elem.setAttribute("data-text", "foo");
document.body.appendChild(elem);
Since this example is so visible, it would be nice if it followed the spec.
Related https://github.com/mdn/web-components-examples/issues/33