New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HTMLDialogElement, HTMLPictureElement,, HTMLSlotElement #66

wants to merge 5 commits into
base: master


None yet
2 participants
Copy link

Inkeliz commented Dec 22, 2018

It's a basic implementation for HTMLDialogElement, HTMLPictureElemenand HTMLSlotElement. I need to do more tests with the Slot. The HTMLDialogElement is only supported on Chrome/Opera, right now.

Because it's only supported by Chrome, if the developer strictly uses the close() and show() and not relies on method="dialog", it's possible make a simple polyfill, such as:

el := dom.GetWindow().Document().QuerySelector("dialog#my-dialog")
if dialog, ok := el.(*dom.HTMLDialogElement); ok {
} else {
	el.SetAttribute("open", "true")

Then, on CSS, do something like dialog[open] { ... }, which will work in both cases.

The PictureElement has nothing special.

I need to test the HTMLSlotElement, because it has . assignedNodes, but also have .assignedElements and assignedSlot. The Mozilla page just say about .assignedNodes(), however.

Inkeliz added some commits Nov 6, 2018

Merge pull request #1 from Inkeliz/matches-closest
Add Element.Closest and Element.Matches

This comment has been minimized.

Copy link

dmitshur commented Jan 3, 2019

Thanks for working on this.

I wanted to check if you had a need or use case for these, or if you were adding them just because they're missing? The general practice for this package to add support for missing DOM elements when someone has a concrete need. It's okay to leave things unimplemented until that need arises. That is especially helpful when it comes to the more esoteric and less widely supported DOM elements, since it's likely they become more well defined and easier to support by the time someone needs them.


This comment has been minimized.

Copy link

Inkeliz commented Jan 4, 2019

I'm currently using it, except the SlotElement. Actually, I also change the source to include the srcset, but I don't publish the code, yet.

I don't use the SlotElement, because I don't know that exists. I'm using only the template. That's the only element that I include just to include. The element.Closest and element.Matches is used in my current project. I'm also using the Dialog, but with some additional code for legacy browsers.

The Picture I use to handle errors. I create one event listener to replace broke images. I must check if the element is a HTMLImage or HTMLPicture. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment