HTMLで一重引用符は有効ですか? より具体的には、XHTML の厳密です。
<table width="100%">
<table width='100%'>
HTMLで一重引用符は有効ですか? より具体的には、XHTML の厳密です。
<table width="100%">
<table width='100%'>
はい、一重引用符は有効です。
XML 仕様から:
[10] AttValue ::= '"' ([^<&"] | Reference)* '"'
| "'" ([^<&'] | Reference)* "'"
この問題に関する混乱の原因は、この記事にあるようです。
http://www.javascriptkit.com/howto/xhtml_intro.shtml
xhtmlでは一重引用符が無効であると主張しているようです。ただし、仕様が引用されておらず、記事では属性と要素の小文字の名前が禁止されているとも主張しているため、著者は単一引用符の使用に対する編集上の禁止を表明しているだけかもしれません.
仕様によると、両方とも有効です:-)
[9] EntityValue ::= '"' ([^%&"] | PEReference | Reference)* '"'
| "'" ([^%&'] | PEReference | Reference)* "'"
[10] AttValue ::= '"' ([^<&"] | Reference)* '"'
| "'" ([^<&'] | Reference)* "'"
[11] SystemLiteral ::= ('"' [^"]* '"') | ("'" [^']* "'")
[12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'"
また、W3C-Validator もそれを受け入れます。