- From: Hayato Ito <hayato@chromium.org>
- Date: Fri, 01 May 2015 03:17:41 +0000
- To: Ryosuke Niwa <rniwa@apple.com>, Domenic Denicola <d@domenic.me>
- Cc: Anne van Kesteren <annevk@annevk.nl>, Justin Fagnani <justinfagnani@google.com>, WebApps WG <public-webapps@w3.org>, Erik Bryn <erik@erikbryn.com>, Dimitri Glazkov <dglazkov@google.com>, "Edward O'Connor" <eoconnor@apple.com>, Steve Orvell <sorvell@google.com>
- Message-ID: <CAFpjS_06_LCQNaYCkHVdX92arP6vO6tXXHiyWMRJJdDTr+Zj1w@mail.gmail.com>
On Fri, May 1, 2015 at 2:59 AM Ryosuke Niwa <rniwa@apple.com> wrote: > > > On Apr 30, 2015, at 6:00 AM, Domenic Denicola <d@domenic.me> wrote: > > > >> This essentially forces distribution to happen since you can observe > the result of distribution this way. Same with element.offsetWidth etc. And > that's not necessarily problematic, > > > > OK. So the claim that the current spec cannot be interoperably > implemented is false? (Not that I am a huge fan of <content select>, but I > want to make sure we have our arguments against it lined up and on solid > footing.) > > > >> but it is problematic if you want to do an imperative API as I tried to > explain in the bit you did not quote back. > > > > Sure, let's dig in to that claim now. Again, this is mostly clarifying > probing. > > > > Let's say we had an imperative API. As far as I understand from the > gist, one of the problems is when do we invoke the distributedCallback. If > we use MutationObserve time, then inconsistent states can be observed, etc. > > > > Why can't we say that this distributedCallback must be invoked at the > same time that the current spec updates the distribution result? Since it > sounds like there is no interop problem with this timing, I don't > understand why this wouldn't be an option. > > There will be an interop problem. Consider a following example: > > The return value of (2) is the same in either case. There is no observable difference. No interop issue. Please file a bug for the spec with a concrete example if you can find a observable difference due to the lazy-evaluation of the distribution. > ```js > someNode = ~ > myButton.appendChild(someNode); // (1) > absolutelyPositionElement.offsetTop; // (2) > ``` > > Now suppose absolutelyPositionElement.offsetTop is a some element that's > in a disjoint subtree of the document. Heck, it could even in a separate > iframe. In some UAs, (2) will trigger style resolution and update of the > layout. Because UAs can't tell redistribution of myButton can affect (2), > such UAs will update the distribution per spec text that says "the > distribution result must be updated before any _use_ of the distribution > result". > > Yet in other UAs, `offsetTop` may have been cached and UA might be smart > enough to detect that (1) doesn't affect the result of > `absolutelyPositionElement.offsetTop` because they're in a different parts > of the tree and they're independent for the purpose of style resolution and > layout. In such UAs, (2) does not trigger redistribution because it does > not use the distribution result in order to compute this value. > > In general, there are thousands of other DOM and CSS OM APIs that may or > may not _use_ the distribution result depending on implementations. > > - R. Niwa > > >
Received on Friday, 1 May 2015 03:18:10 UTC