-
-
Notifications
You must be signed in to change notification settings - Fork 576
INode.HasChildNodes is a property, and according to the spec it should be a method #1219
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
INode.HasChildNodes is a property, and according to the spec it should be a method #1219
Comments
That's right and it would definitely be solved via (2) - I think this should remain a property in .NET. I think the potentially best way forward would be an additional |
I checked the code and see, that It would be possible to check for And besides - placing that code in SetNormalProperties seems a bit out of place... |
|
I need a bit of help to fix this one. Accessors are in AngleSharp, while handling them occurs in AngleSharp.Js, so two pull requests will be required. Even if the first one (AngleSharp) is accepted, AngleSharp.Js still references AS v. 1.1.2, so my changes won't compile. I know the problem might be trivial, but I have no idea how to handle such cases in GH projects. Should I just create these pull request and while you will accept the first, the second one will wait until the reference is changed and then you might accept it? |
Yes, of course I would accept it - but you are right. Being able to fix it with just one PR would be better. I just don't see how. Whatever we do (new attribute, new convention, ...) [as long as we are not breaking] we will always need a PR in AngleSharp.Js. I think this is fine, however. The PR in AngleSharp.Js is just to "teach" AngleSharp.Js about the new attribute / attribute usage. |
Prerequisites
AngleSharp.Css
for CSS support)Description
Being a getter only property is not a problem in AngleSharp itself, but when it is exposed to JS DOM, via DomNameAttribute, then it doesn't conform to the spec.
I decided to report here and not in AngleSharp.JS, as the code in current repo requires fix.
Tested on master versions of AngleSharp, AngleSharp.Js and Jint
Steps to Reproduce
Expected Behavior
Console should output: False
Actual Behavior
Exception is thrown:
Jint.Runtime.JavaScriptException: 'Property 'hasChildNodes' of object is not a function'
Possible Solution / Known Workarounds
Workaround: using
document.createElement('div').hasChildNodes
(without parentheses)Proposed solutions:
Change HasChildNodes to method.
Pros: JS signature is the same as the one in C#
Cons: breaking change
Introduce ExposeAsMethod property in DomNameAttribute and set it to true for that property.
Pros: no breaking change in C#; there's still breaking change in JS if anyone used mentioned workaround, but impact would be much lower
Cons: different C#/JS signatures
The text was updated successfully, but these errors were encountered: