[webkit-dev] getting contents of noscript element through DOM

Maciej Stachowiak mjs at apple.com
Mon Oct 26 00:54:11 PDT 2009


On Oct 26, 2009, at 12:40 AM, Darin Adler wrote:

> On Oct 12, 2009, at 9:30 AM, mab2001 wrote:
>
>> It seems that with WebKit, the contents of the noscript tag cannot  
>> be accessed through the DOM. FF and IE (haven't tested other  
>> browsers) allow access through the textContent property but in  
>> Safari and Chrome this just comes back blank.
>
> I think this is simply a mistake, not something intentional in a  
> thoughtful way.
>
> It’s the HTML parser that’s doing the discarding of the content  
> here. Changing the parser to instead create a text node seems  
> relatively straightforward, although not trivial.
>
>> I've tried looking through the WebKit code to see why this is  
>> happening but admit to being a little lost.
>
> The code in question is in the file HTMLParser.cpp. The content is  
> skipped by calls to the function setSkipMode. The code that actually  
> causes the content to be discarded is the code that calls the  
> skipMode() function in HTMLParser.cpp and HTMLTokenizer.cpp. There  
> are six different call sites.
>
> If we change <noscript>, we probably want to do the same thing for  
> <noembed> and <noframes>.
>
> One of the most important aspects of fixing this bug would be to  
> create some good test cases. Even someone who will not fix the bug  
> could create the bug in bugs.webkit.org and make test cases, try the  
> test cases out in other browsers and make sure they pass. That  
> person could even make the test cases in the proper form for the  
> LayoutTests directory and submit a patch with the test case and the  
> current expected failures as a way to get the ball rolling.

I'd suggest checking whether any of the HTML5 parsing libraries have  
<noscript> tests in their test suites. In general our goal for the  
parser should be to converge towards HTML5 behavior.

  - Maciej



More information about the webkit-dev mailing list