Skip to content

Better reflection support: take 2#2813

Merged
TimothyGu merged 3 commits intojsdom:masterfrom
TimothyGu:reflection2
Mar 24, 2020
Merged

Better reflection support: take 2#2813
TimothyGu merged 3 commits intojsdom:masterfrom
TimothyGu:reflection2

Conversation

@TimothyGu
Copy link
Member

@TimothyGu TimothyGu commented Jan 29, 2020

Same goal as #2790, but uses an approach based on IDL extended attributes. So far works pretty well but the real test will be enumerated attributes, which I'll look at later.

This depends on jsdom/webidl2js#161 and #2822.

@domenic
Copy link
Member

domenic commented Feb 1, 2020

Do you know of any cases where https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#rules-for-parsing-integers would give different results than parseInt(x, 10)? I'd rather reuse that than reimplement the whole algorithm ourselves. It looks like the whitespace trimming is a bit different, parseInt() can return a -0, and parseInt() will ignore trailing garbage, but we could just take care of those cases ourselves? Tests for the changes would be a good idea here.

Also the first couple of commits could be their own independent PR.

@TimothyGu
Copy link
Member Author

We could just adapt the whitespace trimming part of 24d5364 to use with parsing integers, yes. I'm more interested in comments on the approach right now than treating this as something to be merged directly. :)

@domenic
Copy link
Member

domenic commented Feb 3, 2020

I'm more interested in comments on the approach right now than treating this as something to be merged directly. :)

I guess I gave those over in #2790 (comment), oops.

Do you think it's worth proceeding by trying to merge a v1 without enumerated attribute support? I'd be hesitant to do that in the HTML Standard, but for jsdom it's a definite improvement over our current situation, so I'd be fine with that here. Still, it'd be awesome if we could figure out enumerated attributes too.

Otherwise, hmm. I wonder if we should abstract the code we see repeated here a few times for URL handling. E.g. in jsdom (not webidl2js), a util like getURLStringFromAttribute(this, "src") or getURLStringFromAttribute(this, "src", { disallowEmpty: true })

@TimothyGu
Copy link
Member Author

Updated for the latest webidl2js change. Most of the concerns raised in #2790 should now be fixed (with the exception of state-related stuff, which we'll punt into the future for now).

Copy link
Member

@domenic domenic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good. Don't forget to avoid merging until webidl2js is released!

@TimothyGu TimothyGu merged commit 0b1f84f into jsdom:master Mar 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants