I think that laszlo apps developers think more about containment  
hierarchies than class hierarchies. The descendant selector mechanism  
translates beautifully between HTML and lzx usage, and yields  
containment hierarchy selection. Class hierarchies seem more obscure.  
(I didn't know that p is a subclass of div.)

No one uses this feature yet. Let's redefine it so that edgar is who  
I expect him to be. I don't think this change would break any of the  
other tests, which give a lot of coverage to the engine.

I'll give this a try tomorrow.

-ben

On Sep 9, 2006, at 12:14 PM, P T Withington wrote:

> Does anyone use that feature yet?  Or did it just sound neat?  It  
> seems best that we not have 'tag's match subclasses, since that is  
> what people familiar with CSS will expect.
>
> If we want subclass matching, we could introduce a new syntax for  
> that, something like [-lzx-class<="view"].
>
> On 2006-09-09, at 14:40 EDT, Adam Wolff wrote:
>
>> well, we could say that css style rules don't apply to subclasses. I
>> argued for that earlier but everyone hated that idea.
>>
>> A
>>
>> On Sep 9, P T Withington wrote:
>>
>>> On 2006-09-09, at 12:15 EDT, Adam Wolff wrote:
>>>
>>>> This is expected behavior. The reason for it is not that edgar  
>>>> is looking
>>>> at its parent for the value of testdata, it's that edgar is also  
>>>> a view,
>>>> and right now our specificity stuff doesn't account for the more  
>>>> direct
>>>> applicability of the subclass selector.
>>>
>>> If this is 'expected' it's going to confuse the heck out of  
>>> people who expect
>>> our CSS to work like w3c CSS.
>>>
>>> As I said in my response, Ben's intuition matches CSS.  Here is  
>>> my equivalent
>>> CSS:
>>>
>>> <style type="text/css">
>>> <!--
>>>        /* rule 1, specificity 10 */
>>>        [name="thename"] { background-image: url(confused.jpg); }
>>>       /* rule 2, specificity 1 */
>>>        p { background-image: url(w00t.jpg); }
>>>       /* rule 3, specificity 1 */
>>>        div { background-image: url(sad.jpg); }
>>> -->
>>> </style>
>>> <div name="thename">
>>>     <p id="edgar">
>>>             <span name="background-image" style="font-size: 72pt">This is
>>> a test</span>
>>>     </p>
>>> </div>
>>>
>>> Which will display the background-image 'w00t'.
>>>
>>> In CSS a `p` is effectively a `div` with specific defaults for  
>>> css attributes,
>>> but rule 3 will never apply to a `p`.
>>>
>>>> You can confirm this by switching the order of the rules, and  
>>>> you'll get a
>>>> different result. I assume that the applicability of rules with  
>>>> the same
>>>> specificity in CSS is undefined, but ours happen to roughly  
>>>> mimic lexical
>>>> order for now because we are using array.sort which I think is  
>>>> stable.
>>>
>>> One of the cascade rules of CSS is lexical order.  Later rules  
>>> with equal
>>> specificity take precedence over earlier rules.
>>>
>>>> It would be nice to make subclasses more specific than  
>>>> superclasses, but
>>>> that would make specificity a function of not only the selector,  
>>>> but also
>>>> the node being selected, and that seems like a pain.
>>>
>>> I think the idea of making a CSS tag selector select for  
>>> `instanceof` is
>>> appealing, but it is going to confuse the heck out of people who  
>>> are expecting
>>> it to be like a CSS tag selector, as Ben's example shows.
>>>
>>> My vote would be to fix this now, before it is released in the  
>>> wild.  The
>>> current behavior could be considered an extension of CSS.  As  
>>> such, it should
>>> probably be indicated with a different syntax than the tag  
>>> selector.  At the
>>> very least we need to tweak it so that a more-specific tag/class  
>>> has more
>>> specificity!
>>>
>>>
>>>
>


_______________________________________________
Laszlo-dev mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-dev

Reply via email to