w3c / largest-contentful-paint

Specification for the LargestContentfulPaint API
https://w3c.github.io/largest-contentful-paint/
Other
88 stars 17 forks source link

Should script-created events set the "has dispatched scroll event" flag? #30

Closed foolip closed 5 years ago

foolip commented 5 years ago

https://wicg.github.io/largest-contentful-paint/#sec-modifications-DOM

Per this document.body.dispatchEvent(new Event('scroll')) should set the flag. This should be tested, and probably it's better to change the spec to use the isTrusted flag to ignore these events. That would make it easier to later change where this information is maintained to the places where the events are created/dispatched, if it turns out the rule for this flag needs to be more complicated.

Follow-up to https://github.com/WICG/largest-contentful-paint/issues/18 and https://github.com/WICG/largest-contentful-paint/pull/23.

npm1 commented 5 years ago

Can non-trusted scroll events modify the scroll offset of the document?

foolip commented 5 years ago

I haven't tested but hope not. Dispatching events shouldn't trigger any behavior beyond invoking event callbacks, and the only case to the contrary I know of is click events, see https://dom.spec.whatwg.org/#dispatching-events and notes elsewhere in DOM, just search for "click".