@@ -576,6 +576,30 @@ Remains `undefined` if there is no attribute value.
576576[href ] /* undefined */
577577```
578578
579+ ### ` attribute.qualifiedAttribute `
580+
581+ Returns the attribute name qualified with the namespace if one is given.
582+
583+ ### ` attribute.offsetOf(part) `
584+
585+ Returns the offset of the attribute part specified relative to the
586+ start of the node of the output string. This is useful in raising
587+ error messages about a specific part of the attribute, especially
588+ in combination with ` attribute.sourceIndex ` .
589+
590+ Returns ` -1 ` if the name is invalid or the value doesn't exist in this
591+ attribute.
592+
593+ The legal values for ` part ` are:
594+
595+ * ` "ns" ` - alias for "namespace"
596+ * ` "namespace" ` - the namespace if it exists.
597+ * ` "attribute" ` - the attribute name
598+ * ` "attributeNS" ` - the start of the attribute or its namespace
599+ * ` "operator" ` - the match operator of the attribute
600+ * ` "value" ` - The value (string or identifier)
601+ * ` "insensitive" ` - the case insensitivity flag
602+
579603### ` attribute.raws.unquoted `
580604
581605Returns the unquoted content of the attribute's value.
@@ -588,14 +612,62 @@ Remains `undefined` if there is no attribute value.
588612[href ] /* undefined */
589613```
590614
591- ### ` attribute.raws.insensitive `
615+ ### ` attribute.spaces `
592616
593- If there is an ` i ` specifying case insensitivity, returns that ` i ` along with the whitespace
594- around it.
617+ Like ` node.spaces ` with the ` before ` and ` after ` values containing the spaces
618+ around the element, the parts of the attribute can also have spaces before
619+ and after them. The for each of ` attribute ` , ` operator ` , ` value ` and
620+ ` insensitive ` there is corresponding property of the same nam in
621+ ` node.spaces ` that has an optional ` before ` or ` after ` string containing only
622+ whitespace.
595623
596- ``` css
597- [id = Bar i ] /* " i " */
598- [id = Bar i ] /* " i " */
624+ Note that corresponding values in ` attributes.raws.spaces ` contain values
625+ including any comments. If set, these values will override the
626+ ` attribute.spaces ` value. Take care to remove them if changing
627+ ` attribute.spaces ` .
628+
629+ ### ` attribute.raws `
630+
631+ The raws object stores comments and other information necessary to re-render
632+ the node exactly as it was in the source.
633+
634+ If a comment is embedded within the identifiers for the ` namespace ` , ` attribute `
635+ or ` value ` then a property is placed in the raws for that value containing the full source of the propery including comments.
636+
637+ If a comment is embedded within the space between parts of the attribute
638+ then the raw for that space is set accordingly.
639+
640+ Setting an attribute's property ` raws ` value to be deleted.
641+
642+ For now, changing the spaces required also updating or removing any of the
643+ raws values that override them.
644+
645+ Example: ` [ /*before*/ href /* after-attr */ = /* after-operator */ te/*inside-value*/st/* wow */ /*omg*/i/*bbq*/ /*whodoesthis*/] ` would parse as:
646+
647+ ``` js
648+ {
649+ attribute: " href" ,
650+ operatator: " =" ,
651+ value: " test" ,
652+ spaces: {
653+ before: ' ' ,
654+ after: ' ' ,
655+ attribute: { before: ' ' , after: ' ' },
656+ operator: { after: ' ' },
657+ value: { after: ' ' },
658+ insensitive: { after: ' ' }
659+ },
660+ raws: {
661+ spaces: {
662+ attribute: { before: ' /*before*/ ' , after: ' /* after-attr */ ' },
663+ operator: { after: ' /* after-operator */ ' },
664+ value: { after: ' /* wow */ /*omg*/' },
665+ insensitive: { after: ' /*bbq*/ /*whodoesthis*/' }
666+ },
667+ unquoted: ' test' ,
668+ value: ' te/*inside-value*/st'
669+ }
670+ }
599671```
600672
601673## ` Processor `
0 commit comments