These two [class^=test]
and [class|=test]
matches the same elements as I see.
Is there any real difference or case why should I use one over the other?
These two [class^=test]
and [class|=test]
matches the same elements as I see.
Is there any real difference or case why should I use one over the other?
[class^="test"]
The above selects all elements that starts with class "test", it will fail to find if the test is second class.
But:
[class|="test"]
finding elements that matches class, won't show you if the class is "testing" but will find if the class is "test-ing", the above one will match both. Also , it will fail to find if the test is second class.
[class|="test-"]
And this case will only accept "test-" and won't accept "test-ing" or a string which starts with "test-", e.g., "test-ing".