-
Notifications
You must be signed in to change notification settings - Fork 5
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
ProcessingInstruction Node fails check #5
Comments
Oh OK - MDN says that a (typeof val.nodeType === 'number') &&
((typeof val.nodeName === 'string') || (typeof val.target === 'string')) If that looks good I can submit a PR. |
Sorry for the noise, but it looks like my issue is probably coming from
Let me know if you have any other info, though, closing this for now. |
👍 Thanks for the notes - it wouldn't hurt to have a test for this - do you have a snippet of code to construct a |
@TehShrike - no problem. I do, this is all it would take: const pi = document.createProcessingInstruction('xml-stylesheet', 'href="mycss.css" type="text/css"'); I think that would pass the check in the library (but I'm not sure) - my issue seemed to have been |
I have a
ProcessingInstruction
Node that gets passed to this library to check if it's a Node. However, this specific type of node is returningfalse
- I believe it should return true.Here's a representation of the Node I'm talking about (and MDN docs here):
Note that this type of Node has a
nodeType
, but not anodeName
. The actual XML would look something like this:It fails because these types of Nodes have a
nodeType
property, but not anodeName
property:Do you agree this should be returning True on these types of nodes? I'd be happy to submit a PR with a fix, just not sure of the best way to go about.
One options: the
typeof window === 'object' && typeof window.Node === 'object'
could have one more case to check|| typeof window.Now === 'function'
. This would return true, andval instanceof window.Node
would return true as well.Let me know what you think!
The text was updated successfully, but these errors were encountered: