[Bug 24756] [imports]: Cascading order for stylesheets of imported documents should be stated more clearly

https://www.w3.org/Bugs/Public/show_bug.cgi?id=24756

--- Comment #7 from Morrita Hajime <morrita@google.com> ---

(In reply to Gabor Krizsanits from comment #3)
> Right, now I have a little concern about this definition, although I could
> not come up with anything better yet. So the problem is that we let's say
> parsing/building two imports in sort of parallel. We determine their
> position to each other in the import graph, and adding their stylesheets to
> the document accordingly. Then when we find a link import that changes their
> order in the import graph, we will have to look up all their sheets from the
> document and reorder them. This is kind of suboptimal...

Yeah, I see your point. I first prototyped fixed order version in Blink but
got complaint that the order of <link> should be considered as rel=stylesheet.
So I gave it up and changed it to pay some complexity for developer ergonomics.

> 
> It is also a bit concerning that if someone sees <link rel=import id=A><link
> rel=import id=B> in a document, one would think that style sheets of A will
> come before the ones of B, while this can be totally change any time one
> imports B in some other part of the import tree... This is not just a bit
> counter-intuitive but also hurts encapsulation somewhat. Then again I could
> not find a better definition yet, just want to put my concerns out there for
> now. Thoughts?

Well, right. This is another story how de-dup complicates things and
I don't have good answer for this either :-(
Actually same things can be said for <script>.
So I don't think this is style specific problem.

Just a random idea: UAs could emit some warning if an import has a stylesheet
link
that is de-duped in some unexpected way.

For example:

- index.html
  <link href=a.html>
  <link href=b.html>

- a.html
  <link href=x.html>
  <link href=y.html>
- b.tml
  <link href=z.html>
  <link href=x.html> <!-- This can be confusing -->

Then UA can probably warn that a.html and b.html disagree about the position of
x.html.
Talking more abstractly, 

- We can give each import an "order" based on import tree.
- The "orders" of imports of a document should be increasing.

In example above, The order is a=0, x=1, y=2, b=3, z=4.
Because b.html has imports {z(order=4), x(order=1)}, it violates the
"no-surprise" rule.

Well, it's kinda like how good #include should be formed in C++...

I'm not sure if this is practical or not.
Probably this is better done by preprocessors like grunt tasks.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Wednesday, 30 July 2014 17:20:38 UTC