I guess the result of the above is that rendering is blocked longer than
expected, since it renders when the document readiness is no longer
"loading"?

Yeah, it'd be nice to follow the spec here and allow #target-id to be
decided even if it isn't inserted by the parser.

This is important for "render", but even more important for
this "full-frame-rate" proposal, since it's common for JS-heavy SPAs to be
network-heavy until their main content loads.

On Wed, 12 Mar 2025 at 09:18, Jiacheng Guo <g...@google.com> wrote:

> Yes, inserting render-blocking elements in the headers is supported.
> I'm not very accurate in the previous message. The current situation is
> that Chrome cannot fulfill a render-blocking element to unblock the
> renderer if it is inserted from the script.
>
> For instance, this page will not work:
>
>     <!doctype html>
>     <head>
>       <link rel="expect" href="#target-id" blocking="render"/>
>     </head>
>     <body>
>       <script>
>         var div_element = document.creteElement('div');
>         div_element.id = 'target-id';
>         div_element.textContent = 'test';
>         document.body.appendChild(div_element);
>       </script>
>     </body>
>
> On Wed, Mar 12, 2025 at 6:08 PM Noam Rosenthal <nrosent...@chromium.org>
> wrote:
>
>>
>>
>> On Wed, Mar 12, 2025 at 2:35 AM 'Jiacheng Guo' via blink-dev <
>> blink-dev@chromium.org> wrote:
>>
>>> I have checked with @Vladimir Levin <vmp...@google.com>. Currently
>>> chrome is not supporting inserting any kind of render-blocking elements
>>> from javascript. Since it is a very practical use case we may work on
>>> adding the support.
>>>
>>
>> I don't think this is accurate. It's possible to insert render-blocking
>> elements using javascript if the script is run before the parser sees the
>> body element.
>> Specifically for <link rel=stylesheet> it's the only utility of
>> blocking=render as parser-inserted stylesheets are render-blocking to begin
>> with.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to blink-dev+unsubscr...@chromium.org.
To view this discussion visit 
https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAJ5xic82VaBW8fvJKXPEZ_i8y_NYkMim8m4zuDfuu6T8AaadyQ%40mail.gmail.com.

Reply via email to