08:34
<sujaldev>
Hi, Can anyone please describe what is the exact procedure to "Consume the maximum number of characters possible" mentioned here: https://html.spec.whatwg.org/#named-character-reference-state
08:45
<Andreu Botella (he/they)>
Hm, there's arguably a bug there, since the string &center should only match the charref &cent, rather than the prefix of &centerdot;
08:50
<sujaldev>
So what's the correct way to do this?
08:51
<Andreu Botella (he/they)>
Keep a copy of the named character references list, and for every consumed character, remove the entries that don't match up for that character
08:53
<Andreu Botella (he/they)>
But keep in a variable the latest entry that you have consumed in full (that is, for which the next character would be end-of-string)
08:54
<Andreu Botella (he/they)>
Once the list is empty, unconsume as many characters as (number of characters you've consumed in this algorithm - length of the latest entry consumed in full or 0)
08:54
<Andreu Botella (he/they)>
the latest entry consumed in full is the match you've found, if there is any
08:56
<sujaldev>
sorry to ask a stupid question but what does it mean to "unconsume" here?
08:59
<Andreu Botella (he/they)>
To walk back the pointer into the input stream, such that the next input characters would be the characters after the end of the matched character reference, even if in parsing you've consumed more characters than those
09:00
<sujaldev>
oh ok! thank you for the help!!
09:08
<Andreu Botella (he/they)>
If it's not very obvious, that part of the algorithm tries to find the longest character reference that matches the input
09:09
<Andreu Botella (he/they)>
So both cent and centerdot; are character references, so if the next few characters are center;, you want to match cent only
09:09
<Andreu Botella (he/they)>
If you're reading character by character, you would have to read center and then backtrack when you find the semicolon
09:10
<Andreu Botella (he/they)>
but if you do find centerdot; you want to take that as the match, not cent
09:24
<sujaldev>
So from what I understand from the above explanation an html stream <p>&center;</p> would be read as <p>&cent;er;</p> right?
09:24
<sujaldev>
displayed as: ¢er;
09:28
<sideshowbarker>
sujaldev: center; would never reach that algorithm — because center; doesn’t begin with an & ampersand
09:29
<sujaldev>
sorry i mean &center;
09:29
<sujaldev>
let me just edit that
09:31
<Andreu Botella (he/they)>
¢er; indeed
09:32
<sujaldev>
trying to implement it now in my project! thank you again!
09:35
<sideshowbarker>
sujaldev: I guess you probably already know about the html5lib test suite, but if not, you definitely want to be testing your implementation against that — https://github.com/html5lib/html5lib-tests
09:36
<sideshowbarker>
and not to muddy the waters, but it’s worth mentioning that you don’t need to match the steps in that part of the parsing algorithm exactly, as long as you end up with the same result
09:37
<sujaldev>
sujaldev: I guess you probably already know about the html5lib test suite, but if not, you definitely want to be testing your implementation against that — https://github.com/html5lib/html5lib-tests
I didn't know about this, real helpful.
09:37
<sideshowbarker>
yeah for https://github.com/validator/htmlparser we don’t match the spec steps exactly for that part of the algorithm, but do it in a different way that produces the same test results
09:39
<sujaldev>
does it still follow state machine concept?
09:39
<sideshowbarker>
yes
09:41
<sideshowbarker>
there are some places where it doesn’t conform to the spec, and I’ve had some pull requests open for quite a while now to fix those, but… fixing them has not been a big priority for that particular project
09:43
<sujaldev>
yeah for https://github.com/validator/htmlparser we don’t match the spec steps exactly for that part of the algorithm, but do it in a different way that produces the same test results
If I knew more about parsing and also knew java would have loved to contribute to this
17:04
<shu>
how do overloads work in WebIDL? specifically, for Window.alert, which is spec'd to have two overloads alert() and alert(message), what's alert.length supposed to be?
18:13
<zcorpan>
shu: https://heycam.github.io/webidl/#dfn-create-operation-function
18:13
<zcorpan>
step 6
20:44
<shu>
zcorpan: thanks
22:19
<timothygu>
shu: what's the plan for https://github.com/heycam/webidl/pull/982? is it waiting on ES still?
23:08
<shu>
timothygu: resizable buffers is stage 3, so i was planning on requesting to merge that after there's at least one implementation shipping
23:09
<shu>
it's a fairly big proposal to implement, actually, so we might not see anything till Q4
23:09
<timothygu>
okay, I converted it to a draft in the meantime
23:09
<shu>
ah okay, is that the convention?
23:39
<Domenic>
We invented a "do not merge yet" label convention for WHATWG repos before draft PRs existed. These days it seems like a mix.