Re: [selectors-nonelement] First draft of a new spec for selecting non-element nodes

On Fri, Feb 14, 2014 at 10:19 PM, Andrew Fedoniouk
<news@terrainformatica.com> wrote:
> On Fri, Feb 14, 2014 at 7:50 PM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:
>> On Fri, Feb 14, 2014 at 7:42 PM, Andrew Fedoniouk
>> <news@terrainformatica.com> wrote:
>>> As you know ::before and ::after insert [pseudo] elements
>>> in content flow of matched element.
>>> input, img, etc. have no content in DOM sense so
>>> ::after ::before do not work for them.
>>
>> I know.  Why do you think ::attr() would work any differently?  The
>> contents of an <input> are still outside the realm of CSS.
>>
>> Plus, the placeholder you see isn't literally the attribute.  The
>> placeholder attribute is just one possible way for there to be
>> placeholder text.  I could easily see a UA adding its own
>> (author-overrideable) placeholder text for some types of inputs, and
>> that wouldn't be reflected by the placeholder attribute.
>>
>>> In any case ::after/::before are just two pseudo elements
>>> and sometimes[1] you will need more.
>>
>> I'm definitely aware of that.  Smuggling them in via random unrelated
>> mechanisms is not the correct way to solve this problem.
>>
>
> I believe discussion went too far from the subject.
>
> I just wanted to say that "never" here:
> "In CSS, attribute node pseudo-elements never generate boxes"
> is too strong.
>
> If you allow to create boxed pseudo-elements out of the air
> (before/after) then why "never" for attributes?
>
> AFAIR no one expected what ::before and ::after would
> be used for. These cases for example:
> http://css-tricks.com/pseudo-element-roundup/
> are quite far from initial quotation idea.

::before and ::after are generic, generally-applicable, and well-defined.

Allowing ::attr() to generate a box is none of these.  Attribute nodes
are not children of an element, generating boxes containing their
string value isn't generally useful, and they're not well-defined -
what order would they appear in?

::before and ::after can hold the string contents of an attribute if
that's what's desired, and have been able to do so since CSS 2.1.

Once again, if we need to add *more* arbitrary child pseudo-elements,
we'll do it by extending ::before and ::after (or adding something
similarly general), rather than by smuggling it in via special-purpose
pseudos.

~TJ

Received on Monday, 17 February 2014 16:01:12 UTC