web-components-examples icon indicating copy to clipboard operation
web-components-examples copied to clipboard

popup-info-box-web-component violates HTML spec

Open arcticmatt opened this issue 3 years ago • 1 comments

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.

arcticmatt avatar May 15 '21 05:05 arcticmatt

Related https://github.com/mdn/web-components-examples/issues/33

Rumyra avatar May 06 '22 10:05 Rumyra