Re: [attr|=""] Selector

Bert Bos wrote:


 > If we're talking about the same "they," I think they'd have no clue
 > what you're talking about :-) And if they do, they probably don't
 > agree with you. "abc" doesn't start with "abc", because they are the
 > same.
 >
 > I tried asking some people if "abcd" starts with "abcd" and if "abcd"
 > starts with "", but I didn't even get beyond the question if "abcd"
 > starts with "ab". They didn't understand what "abcd" and "ab" meant
 > and thus couldn't answer the question.


Before I proceed I would like to suggest that we look at what att^=val 
and att$=val really mean. From the specs.

http://www.w3.org/TR/css3-selectors/#attribute-substrings

We see that:

[att^=val] Represents an element with the att attribute whose value 
begins with the prefix "val".


A prefix could also be like "onlist" or "on-list". The prefix is "on"


[att$=val] Represents an element with the att attribute whose value ends 
with the suffix "val".

A suffix could be like "closed". But the suffix here is not "ed" but 
rather "d" since the word is "close". att$=val can not work like this.


Maybe the wording in the specs can be misleading since it may cause some 
to associate prefixes and suffixes with written grammar. Lets rewords 
these specs slightly.


[att^=val] Represents an element with the att attribute whose value 
begins with or is equals to "val".

[att$=val] Represents an element with the att attribute whose value ends 
with or is equals to "val".


So "abcd" starts with "abcd", "abc", "ab", and "a" and "abcd" also ends 
with "abcd", "bcd", "cd", and "d" but in both cases "abcd" also equals 
"abcd"


Then we have:

[att*=val] Represents an element with the att attribute whose value 
contains at least one instance of the substring "val".


So "abcd" can equal "abcd", "abc", "ab", "a" and "d", "cd", "bcd" and 
also "bc". There is also something else there but very hidden. It occurs 
three times in "abcd" between "ab", "bc" and "cd" and it value is "". 
The empty string so infinitely small that we can not measure it. Any 
scientist should know that "" could represent something but for them "" 
just represent zero since they haven't been equipped with the tools to 
measure infinitely small empty spaces.


It get even more crazy when whitespace or a hyphen appears.

.a[class*=""] class="a b-c-d"

.a[class*=" "] class="a b-c-d"

.a[class*="-"] class="a b-c-d"

So val can equal "a b-c-d" but also " " and "-" even though we are 
testing against class="a". If we dropped the class and just have.

[class*=""]

this would also mean that "" also equals class="".


 > One who tried considered that "abcd" starts with "a...". And also
 > considered that "Jean" starts with "je". She recognized in "" a
 > philosophical problem about the infinite and the , but
 > didn't know how to answer the question.


Your not making reference to SaFari there are you? :-)

I scientist must have a test that can be repeated over and over before 
something is deemed real. Thorough and exhausting testing must be done 
before a theory can considered a fact. The fact is known for us that "" 
equals something so infinitely small that we can't even articulate it 
(even too a scientist) but also it equal everything. The only difference 
is we can limit what "" does equal too by att=val, att~=val, att|=val.



 >> which is also how XPath handles the issue
 >> (the empty string is a substring of any string, so any string starts
 >> with and ends with it). The analogous of [example~=""] does not match
 >> be- cause the empty string is not a token so it cannot be in the
 >> token set.
 >
 > As I said, I don't care what we define, either way will be non-intuitive
 > to some people. But I'd rather not have to explain one point of view
 > and its opposite at the same time. People will accept it, but they'll
 > think we're nuts.


About att~="", att|~"" and att=val they can only equal a HTML attribute 
that has an empty string like class="". The attribute presence and value 
selectors are very different to substring attribute matching selectors.

I have just found this.

http://en.wikipedia.org/wiki/Empty_string

The "empty string: is all allowable in C, C++, Perl, Python and C# and 
is represented as {'\0'}, "", '', qw(), str(), string.Empty.


 > If programmers prefer that starts-with(x, x) is true for all strings x,
 > I'm fine with taking that as a principle and explaining to other people
 > that "" is a prefix is of everything, because, well, we had to define
 > it one way or the other and this was easiest for programmers. But then
 > we'll have to change our resolution on the issue again.
 >
 >
 >
 > Bert


We have att^val, att$=val, att*=val which can equal nothing, everything 
or something infinitely small. I will provide this link before some of 
us are go nuts.

http://en.wikipedia.org/wiki/Image:Ninedots-1.png

The challenge is to connect the dots by drawing four straight, 
continuous lines, and never lifting the pencil from the paper.


Whoever does not know of this famous test, please give it a try. I gave 
the same test to my Father and Son and an hour later after I have given 
them many hints, their logical thinking brain could work out how to do 
it. The logical brain will in a split second click in with a limiter 
(preconception) that blocks the path to the solution. The solution is 
below but before clicking the link see if you can see a "big clue" for 
the solution in the link.

http://en.wikipedia.org/wiki/Thinking_outside_the_box


Ok, I must go at this point and work on some more test. :-)


Alan

http://css-class.com/test/

Received on Thursday, 3 April 2008 16:46:46 UTC