spina ha scritto:Quote significa "tra virgolette", poi ci sono le single quote (') e le double quote ("). Però dalle raccomandazioni sembra che si possono usare tutti e due i caratteri per racchiudere il valore dell'attributo.
il fatto è che come ho scritto le RFC dicono altro, ed in altri documenti il w3c parla di quotation mark " ed apostrophe '
Insomma, non usando sempre la stessa definizione ha generato confusione, a questo aggiungici che tutti gli esempi sono con "
Nelle normative in lavorazione per html5 sembra che abbiano capito, ed infatti descrivono entrambi i casi
9.2.4.10 Attribute value (double-quoted) state
Consume the next input character:
U+0022 QUOTATION MARK (")
Switch to the after attribute value (quoted) state.
U+0026 AMPERSAND (&)
Switch to the character reference in attribute value state, with the additional allowed character being U+0022 QUOTATION MARK (").
EOF
Parse error. Reconsume the EOF character in the data state.
Anything else
Append the current input character to the current attribute's value. Stay in the attribute value (double-quoted) state.
9.2.4.11 Attribute value (single-quoted) state
Consume the next input character:
U+0027 APOSTROPHE (')
Switch to the after attribute value (quoted) state.
U+0026 AMPERSAND (&)
Switch to the character reference in attribute value state, with the additional allowed character being U+0027 APOSTROPHE (').
EOF
Parse error. Reconsume the EOF character in the data state.
Anything else
Append the current input character to the current attribute's value. Stay in the attribute value (single-quoted) state.
però si contraddicono, se capisco bene la parte
9.2.4.12 Attribute value (unquoted) state
Consume the next input character:
U+0009 CHARACTER TABULATION
U+000A LINE FEED (LF)
U+000C FORM FEED (FF)
U+0020 SPACE
Switch to the before attribute name state.
U+0026 AMPERSAND (&)
Switch to the character reference in attribute value state, with no additional allowed character.
U+003E GREATER-THAN SIGN (>)
Emit the current tag token. Switch to the data state.
U+0022 QUOTATION MARK (")
U+0027 APOSTROPHE (')
U+003C LESS-THAN SIGN (<)
U+003D EQUALS SIGN (=)
Parse error. Treat it as per the "anything else" entry below.
EOF
Parse error. Reconsume the EOF character in the data state.
Anything else
Append the current input character to the current attribute's value. Stay in the attribute value (unquoted) state.
parlano di valori non quotati, sono tornati indietro sembra, anche se va detto che html5 prevede due metodi, per evitare il casino di xhtml, cioè html5 ed xhtml5, ed xhtml essendo xml non dovrebbe prevedere valori non quotati.
Naturalmente sono in lavorazione, magari metteranno che va messo attr=#value#
però per adesso è come sopra