-
Notifications
You must be signed in to change notification settings - Fork 37
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
Fix type of HtmlElement.ofElement #60
Comments
I have a branch that should fix this. I need to do some more testing before I open a PR. |
It seems that IE doesn't support function.name https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name not sure if we care about IE 11 for these bindings? |
Ah, damn. I had a version that included a fallback but then I saw This is a similar change that was made in TinyMCE recently - turns out there was an edge case where creating an element in the outer window and attaching it in an iframe breaks all instanceof checks. |
But wouldn't the element.defaultView.HTMLElement fix that case? |
There’s a TinyMCE test that failed with the old code. I’ll post the link when I get to my desk. |
I totally forgot we inherited this bug:
https://github.com/tinymce/rescript-webapi/blob/18d9d553201d575fa8e194d3370298b556b28747/src/Webapi/Dom/Webapi__Dom__HtmlElement.res#L8
The type should be
let ofElement: Dom.element => option(t_htmlElement)
but currently it'sDom.element => option<Dom.htmlElement>
. This concrete type breaks modules that inherit fromHtmlElement
, e.g. reasonml-community/bs-webapi-incubator#205This happened when
bs-webapi
was changed to use saferinstanceof
checks rather than the previous way of checking if a HTML attribute existed:https://github.com/reasonml-community/bs-webapi-incubator/pull/182/files?file-filters%5B%5D=.re#diff-f6590c311eac02db4a8591dfe7b1a4c232207269ed2d71105f8407ad4c5ba34dL13-R4
There have been a number of bugs with this change - we perhaps need to rethink it.
The text was updated successfully, but these errors were encountered: