On Mon, Jul 14, 2014 at 09:11:05PM +0530, Rupinder Singh wrote:
On Sat, Jul 12, 2014 at 10:47:48PM +0100, NetSurf Browser Project
wrote:
> I don't understand this changeset. Why have you exposed the tokeniser's
> internal state to the outside world? It is extremely dangerous to do
> this, as it makes it utterly unclear what triggers a state transition.
> Additionally, only the tokeniser needs to know what state it is in; the
> client of the tokeniser must treat it as a black box.
>
> I had the same concerns. Wanted to, but couldn't discuss it earlier. I
did it as the specs say that the treebuilder must change tokeniser's state
here, under "script" start tag, step 7.
http://www.whatwg.org/specs/web-apps/current-work/multipage/tree-construc...
.. There can be workarounds to avoid this. Please suggest some, or I'll try
to work out some.
Well, the existing precedent for this kind of thing is the tokeniser's
content model, or the pause flag. Essentially, hubbub_tokeniser_setopt
is used to inject configuration into the tokeniser, which it is
perfectly at liberty to ignore, if it wants. The point here is that the
injection of configuration is a *request* to do something, which allows
the internals of the tokeniser to be kept private from its client.
J.