This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
tools:shepherd:specs [2014/12/09 15:48] – external edit 127.0.0.1 | tools:shepherd:specs [2018/04/21 10:30] (current) – plinss | ||
---|---|---|---|
Line 10: | Line 10: | ||
Shepherd recognizes any of the following as a definition anchor: | Shepherd recognizes any of the following as a definition anchor: | ||
- | * a <dfn> element with an ‘id’ attribute | + | * a <dfn> element with an 'id' |
- | * an <a> element with a ‘name’ or ‘id’ attribute that contains a < | + | * an <a> element with a 'name' |
- | * a <dt> element with an ‘id’ that contains a < | + | * a <dt> element with an 'id' |
- | * a <dfn> inside a section heading that has an ‘id’ with the value: | + | * a <dfn> inside a section heading that has an 'id' |
In addition to the default ' | In addition to the default ' | ||
- | ; CSS : ' | + | ; CSS : ' |
- | ; HTML/SVG : ' | + | ; HTML/SVG : ' |
- | ; WebIDL : ' | + | ; WebIDL : ' |
+ | ; Other : ' | ||
Line 25: | Line 26: | ||
Shepherd classifies definition anchors according to the following logic (first match wins): | Shepherd classifies definition anchors according to the following logic (first match wins): | ||
- | - A ‘data-dfn-type’ attribute on the <dfn> with a valid type < | + | - A 'data-dfn-type' |
- | - An ‘id’ on the <dfn> (or container <a> or <dt> with the ‘id’) that has one of the following prefixes: < | + | - An 'id' |
- | * ' | + | * ' |
- | * ' | + | * ' |
- | * ' | + | * ' |
- | * ' | + | * ' |
- | * ' | + | * ' |
- | * ' | + | * ' |
- | * ' | + | * ' |
- | * 'tokendef-‘ -> 'token' | + | * ' |
- | * ' | + | * ' |
- | * ' | + | * 'grammardef-' |
- | * ' | + | * ' |
- | * ' | + | * ' |
- | * ' | + | * ' |
- | * ' | + | * ' |
- | * ' | + | * ' |
- | * ' | + | * ' |
- | * ' | + | * ' |
- | * ' | + | * ' |
- | * ' | + | * ' |
- | * ' | + | * ' |
- | * ' | + | * ' |
- | * ' | + | * ' |
- | * ' | + | * ' |
- | * ' | + | * ' |
- | * 'enumdef-‘ -> 'enum' | + | * ' |
- | * 'constdef-‘ -> 'const' | + | * ' |
- | * 'typedefdef-‘ -> 'typedef' | + | * ' |
- | - If the <dfn>’s ‘id’ has one of the following “magic” prefixes (for legacy support, not recommended for use in new specs): | + | * ' |
- | * ‘attr-‘ -> ‘attribute’ | + | * ' |
- | * ‘interface-‘ -> ‘interface’ | + | * ' |
- | * ‘dom-‘ -> some IDL construct - WebIDL found in the specification will be searched for a construct having the same name as the text contents of the < | + | * ' |
- | - if the <dfn> content starts with an uppercase letter -> ‘interface’ | + | * ' |
- | - if it looks like a function < | + | * ' |
- | - otherwise -> ‘attribute’ | + | * ' |
+ | * ' | ||
+ | * ' | ||
+ | * ' | ||
+ | * ' | ||
+ | * ' | ||
+ | * ' | ||
+ | * ' | ||
+ | * 'except-codedef-' | ||
+ | * 'http-headerdef-' | ||
+ | * 'schemedef-' | ||
+ | - If the <dfn>'s 'id' | ||
+ | * 'attr-' | ||
+ | * 'interface-' | ||
+ | * 'dom-' | ||
+ | - if the <dfn> content starts with an uppercase letter -> 'interface' | ||
+ | - if it looks like a function < | ||
+ | - otherwise -> 'attribute' | ||
- Search WebIDL found in the specification for a construct having the same name as the text, if found, use that type | - Search WebIDL found in the specification for a construct having the same name as the text, if found, use that type | ||
- | - Look for the nearest ancestor with a valid ‘data-dfn-type’ attribute, or one of the following classes: | + | - Look for the nearest ancestor with a valid 'data-dfn-type' |
* ' | * ' | ||
* ' | * ' | ||
+ | * ' | ||
+ | * ' | ||
* ' | * ' | ||
* ' | * ' | ||
Line 70: | Line 90: | ||
* ' | * ' | ||
* ' | * ' | ||
- | * 'tokendef' -> 'token' | + | * 'grammardef' -> 'grammar' |
+ | * ' | ||
+ | * ' | ||
+ | * ' | ||
+ | * ' | ||
+ | * ' | ||
+ | * ' | ||
* ' | * ' | ||
* ' | * ' | ||
+ | * ' | ||
+ | * ' | ||
* ' | * ' | ||
* ' | * ' | ||
Line 79: | Line 107: | ||
* ' | * ' | ||
* ' | * ' | ||
+ | * ' | ||
* ' | * ' | ||
+ | * ' | ||
+ | * ' | ||
* ' | * ' | ||
* ' | * ' | ||
Line 85: | Line 116: | ||
* ' | * ' | ||
* ' | * ' | ||
- | * ' | ||
- | * ' | ||
* ' | * ' | ||
+ | * ' | ||
* ' | * ' | ||
- | * ' | + | * ' |
+ | * ' | ||
+ | * ' | ||
+ | * ' | ||
+ | * ' | ||
+ | * ' | ||
- Look at the text content of the <dfn> and use the following heuristics: | - Look at the text content of the <dfn> and use the following heuristics: | ||
- | - If the <dfn> content starts with ‘@‘ -> ‘at-rule’ < | + | - If the <dfn> content starts with '@' |
- | - If the <dfn> content is quoted, e.g.: < | + | - If the <dfn> content is quoted, e.g.: < |
- | - If the <dfn> content starts with ‘<‘ and ends with ‘>’ -> ‘type’ < | + | - If the <dfn> content starts with '<' |
- | - If the <dfn> content starts with ‘:’ -> ‘selector’ < | + | - If the <dfn> content starts with ':' |
- | - If the <dfn> content looks like a function and the ‘id’ does not start with ‘dom-‘ -> ‘function’ < | + | - If the <dfn> content looks like a function and the 'id' |
+ | |||
+ | In addition there are special rules for legacy SVG specs: | ||
+ | |||
+ | - For <p>, <dt>, and section heading elements that are anchors, if the element contains a < | ||
+ | - if one of the classes is one of the above definition classes plus ' | ||
+ | - if one of the classes is ' | ||
+ | - if one of the classes is ' | ||
+ | - if the element is a section heading and one of the classes is ' | ||
+ | - if the element is a section heading and one of the classes is ' | ||
+ | - For section headings, if the anchor name and the section name both start with ' | ||
==== Anchor Relationships ==== | ==== Anchor Relationships ==== | ||
Line 101: | Line 147: | ||
Shepherd also attempts to determine the relationship between anchors, e.g. which element is an attribute defined for. The logic for determining that is as follows (first match wins): | Shepherd also attempts to determine the relationship between anchors, e.g. which element is an attribute defined for. The logic for determining that is as follows (first match wins): | ||
- | - Use the value of the < | + | - Use the value of the < |
- If the <dfn> is an IDL construct, determine the relationship from the IDL | - If the <dfn> is an IDL construct, determine the relationship from the IDL | ||
- | - Look for the nearest element ancestor with a ‘data-dfn-for’ attribute < | + | - Look for the nearest element ancestor with a 'data-dfn-for' |
<dfn id=“image-width”> | <dfn id=“image-width”> | ||
<dfn id=“image-hieght”> | <dfn id=“image-hieght”> | ||
< | < | ||
- |