Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #80805
| Newsgroups | comp.lang.javascript |
|---|---|
| Date | 2023-12-29 06:38 -0800 |
| Message-ID | <eeeb2167-2ea3-403c-aace-7c109675fecen@googlegroups.com> (permalink) |
| Subject | Css Selectors Download |
| From | Analisa Hadfield <hadfieldanalisa@gmail.com> |
Selectors are patterns that match against elements in a tree, and as such form one of several technologies that can be used to select nodes in a document. Selectors have been optimized for use with HTML and XML, and are designed to be usable in performance-critical code. They are a core component of CSS (Cascading Style Sheets), which uses Selectors to bind style properties to elements in the document.Selectors Level 4 describes the selectors that already exist in [SELECT], and further introduces new selectors for CSS and other languages that may need them.
css selectors download
Download File https://t.co/RM9R35GSyK
Pseudo-element selectors,which define abstract elements in a rendering tree,are not part of this specification:their generic syntax is described here,but, due to their close integration with the rendering model and irrelevance to other uses such as DOM queries,they will be defined in other modules.
A simple selector is a single condition on an element.A type selector, universal selector, attribute selector, class selector, ID selector,or pseudo-class is a simple selector.(It is represented by in the selectors grammar.)A given element is said to match a simple selector when that simple selector,as defined in this specification and in accordance with the document language,accurately describes the element.
A compound selector is a sequence of simple selectors that are not separated by a combinator,and represents a set of simultaneous conditions on a single element.If it contains a type selector or universal selector,that selector must come first in the sequence.Only one type selector or universal selector is allowed in the sequence.(A compound selector is represented by in the selectors grammar.)A given element is said to match a compound selector when it matches all simple selectors in the compound selector.
A combinator is a condition of relationship between two elementsrepresented by the compound selectors on either side.Combinators in Selectors Level 4 include:the descendant combinator (white space),the child combinator (U+003E, >),the next-sibling combinator (U+002B, +),and the subsequent-sibling combinator (U+007E, ).Two given elements are said to match a combinator when the condition of relationship between these elements is true.
A complex selector isa sequence of one or more compound selectors separated by combinators.It represents a set of simultaneous conditionson a set of elements in the particular relationshipsdescribed by its combinators.(Complex selectors are represented by in the selectors grammar.)A given element is said to match a complex selector when there exists a list of elements,each matching a corresponding compound selector in the complex selector,with each pair of elements consecutive in the list matchingthe combinator between their corresponding compound selectors,and with the last element being the given element.
Many of the selectors depend on the semantics of the document language (i.e. the language and semantics of the document tree)and/or the semantics of the host language (i.e. the language that is using selectors syntax).For example, the :lang() selector depends on the document language (e.g. HTML)to define how an element is associated with a language.As a slightly different example, the ::first-line pseudo-elementdepends on the host language (e.g. CSS)to define what a ::first-line pseudo-element representsand what it can do.
Certain contexts may accept relative selectors,which are a shorthand for selectors that represent elements relative to one or more relative selector anchor elements.Relative selectors begin with a combinator,with a selector representing the anchor element implied at the start of the selector.(If no combinator is present,the descendant combinator is implied.)
Pseudo-classes are simple selectors that permit selection based oninformation that lies outside of the document treeor that can be awkward or impossible to express using the other simple selectors.They can also be dynamic,in the sense that an element can acquire or lose a pseudo-classwhile a user interacts with the document,without the document itself changing. Pseudo-classes do not appear in or modify the document source or document tree.
Like pseudo-classes pseudo-elements do not appear in or modify the document source or document tree.Accordingly, they also do not affect the interpretation of structural pseudo-classes or other selectors pertaining to their originating element or its tree.
Unless the corresponding sub-pseudo-element is explicitly defined to exist in another specification,pseudo-element selectors are not validwhen compounded to another pseudo-element selector.So, for example, ::before::before is an invalid selector,but ::before::marker is valid(in implementations that support the ::before::marker sub-pseudo-element).
Certain selectors support namespace prefixes.The mechanism by which namespace prefixes are declared should be specified by the language that uses Selectors.If the language does not specify a namespace prefix declaration mechanism,then no prefixes are declared.In CSS, namespace prefixes are declared with the namespace rule. [CSS3NAMESPACE]
A comma-separated list of selectors represents the union of allelements selected by each of the individual selectors in the selector list.(A comma is U+002C.) For example, in CSS when several selectors sharethe same declarations, they may be grouped into a comma-separatedlist. White space may appear before and/or after the comma.
Warning: the equivalence is true in this examplebecause all the selectors are valid selectors. If just one of theseselectors were invalid, the entire selector list would beinvalid. This would invalidate the rule for all three headingelements, whereas in the former case only one of the three individualheading rules would be invalidated.
The relational pseudo-class, :has(),is a functional pseudo-class taking a as an argument.It represents an element if any of the relative selectors would match at least one elementwhen anchored against this element.
The :has() pseudo-class cannot be nested; :has() is not valid within :has().Also, unless explicitly defined as a :has-allowed pseudo-element, pseudo-elements are not valid selectors within :has().(This specification does not define any :has-allowed pseudo-elements,but other specifications may do so.)
Multiple attribute selectors can be used to represent severalattributes of an element, or several conditions on the sameattribute. Here, the selector represents a span elementwhose hello attribute has exactly the value "Cleveland"and whose goodbye attribute has exactly the value"Columbus":
Attribute selectors represent attribute values in the document tree.How that document tree is constructed is outside the scope of Selectors.In some document formats default attribute values can be defined in a DTD orelsewhere, but these can only be selected by attribute selectors if theyappear in the document tree. Selectors should be designed so that theywork whether or not the default values are included in the document tree.
When matching against a document which is in quirks mode,class names must be matched ASCII case-insensitively;class selectors are otherwise case-sensitive,only matching class names they are identical to. [INFRA]
The :dir() pseudo-class allows the author to writeselectors that represent an element based on its directionalityas determined by the document language.For example, [HTML5] defines how to determine the directionality of an element,based on a combination of the dir attribute, the surrounding text, and other factors.As another example, the its:dir and dirRule elementof the Internationalization Tag Set [ITS20] are able to define the directionality of an element in [XML10].
If the document language specifies howthe (human) content language of an element is determined,it is possible to write selectors thatrepresent an element based on its content language.The :lang() pseudo-class,which accepts a comma-separated list of one or more language ranges,represents an element whose content language is one of the languages listed in its argument.Each language range in :lang() must be a valid CSS or .(Thus language ranges containing asterisks, for example,must be either correctly escaped or quoted as strings,e.g. :lang(\*-Latn) or :lang("*-Latn").)
In some contexts, selectors are matchedwith respect to one or more scoping roots,such as when calling the querySelector() method in [DOM].The :scope pseudo-class representsthis scoping root,and may be either a true elementor a virtual one (such as a DocumentFragment).
Its alternate form :current(), like :is(),takes a list of compound selectors as its argument: it represents the :current element that matches the argument or, if that doesnot match, the innermost ancestor of the :current elementthat does. (If neither the :current element nor its ancestorsmatch the argument, then the selector does not represent anything.)
Selectors introduces the concept of structural pseudo-classes to permit selection based on extra information that lies inthe document tree but cannot be represented by other simple selectors orcombinators.
At times, authors may want selectors to describe an element that isthe descendant of another element in the document tree (e.g., "an em element that is contained within an H1 element").The descendant combinator expresses such a relationship.
represents a p element that is a grandchild or laterdescendant of a div element. Note the whitespace oneither side of the "*" is not part of the universal selector; thewhitespace is a combinator indicating that the div must be theancestor of some element, and that that element must be an ancestorof the p.The following selector, which combines descendant combinators and attribute selectors, represents anelement that (1) has the href attribute set and (2) isinside a p that is itself inside a div:
The subsequent-sibling combinator is made of the "tilde"(U+007E, ) code point that separates two compound selectors.The elements represented by the two compound selectors sharethe same parent in the document tree and the element represented bythe first compound selector precedes (not necessarily immediately) the elementrepresented by the second one.
35fe9a5643
Back to comp.lang.javascript | Previous | Next | Find similar | Unroll thread
Css Selectors Download Analisa Hadfield <hadfieldanalisa@gmail.com> - 2023-12-29 06:38 -0800
csiph-web