On Tue, Aug 4, 2015 at 1:52 PM, Bobby Holley <bobbyhol...@gmail.com> wrote:
> On Tue, Aug 4, 2015 at 12:10 PM, James Burke <jbu...@mozilla.com> wrote:
>> If the meta tag, or whatever the toggle becomes, is set, then I expect
>> if the page's JS asks for a DOM element's box properties, it will get
>> values like 0 for sizes, since I believe the goal is to avoid the
>> browser doing extra work until the page's JS got everything set up.
>>
>> If that is the case, should there be a promise API for knowing when
>> the first layout and rendering has occurred so that the page's JS can
>> then ask for element box properties to get accurate values?
>
>
> We could fire an event if that seems necessary. A Promise API is overkill
> and inconsistent with the way other stuff like this works.

An event implies the page's JS to scan to see if there are any meta
tag toggles in play, to make sure the code did not miss the event.

At some point APIs that are just about one and done async operations,
like DOMContentLoaded and this one, seem to make sense to expose via a
promise API[1] to avoid the "did I miss the one event that ever fires
for this condition, check a property and if not set, bind an event
listener" pattern.

But if an event is better in this case to leverage existing code
paths/idioms, so be it.

James

[1] https://www.w3.org/2001/tag/doc/promises-guide
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to