[webkit-help] DOM without rendering?

Erik Arvidsson arv at chromium.org
Fri Apr 20 14:48:17 PDT 2012


You can use document without a renderer. I think everything you listed
works as expected in a disconnected document.

var doc = document.implementation.createHTMLDocument('Hello World');
assert(doc.querySelector('html > title'),textContent === 'Hello World');

This will not load any external resources. But like Ryosuke said,
there are things that might be a bit surprising, especially when it
comes to style and dimensions.

erik







On Mon, Apr 16, 2012 at 15:41, Luke Scott <luke at cywh.com> wrote:
>
> On Mon, Apr 16, 2012 at 2:18 PM, Luke Scott <luke at cywh.com> wrote:
>>
>>
>> On Mon, Apr 16, 2012 at 2:04 PM, Luke Scott <luke at cywh.com> wrote:
>>>
>>> Is there a way to use the DOM component of webkit without the rendering?
>>
>>
>> You can't. querySelector, and other CSS-related DOM properties won't work
>> without renderers. You can, of course, not paint pages. Check
>> out http://phantomjs.org/
>>
>> - Ryosuke
>>
>>
>> Does this mean that I can't prevent an IMG tag for loading the image?
>
>
> You can but then you do, then web pages obviously won't function as intended
> because onerror, instead of, onload will fire if you prevent the image load.
> If you pretend as if the image loaded, then width, height, etc... will be
> wrong. So offsetTop, etc... will return wrong values.
>
> - Ryosuke
>
>
> Perhaps webkit isn't what I'm looking for then. I just don't need the
> overhead. I just want to manipulate the DOM. I don't need position offsets
> or events.
>
> I suppose what I'm asking for is similar to libxml + xpath. I just need to
> load HTML + CSS selectors & HTML 5 form validation.
>
> Luke
>
> _______________________________________________
> webkit-help mailing list
> webkit-help at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-help
>


More information about the webkit-help mailing list