66. id、class命名及Html辅助类

HTML class ID 龚龖龔龒

HTML 龑龍龌龉 W3C 齽齻龚齺齹齷龚齴齳龑龍齲齮齪 class id 龖龔齢齠齝齛齗龒

龱龔龒齕齒龉齑齏齎齊龚齇齅齄

ID 龔龒齃齀鼽齕齺鼼鼻鼺鼹鼶齑鼴齇齅齺鼰鼬齕鼩齇齅齺鼧鼦鼢鼺鼡齇鼞龑鼝齅鼙齺鼧鼦鼦鼡齇鼖齇鼒鼖齝鼐鼏鼋鼉鼆鼆齺鼂鼦齝黿黾龒

https://www.w3.org/TR/html52/dom.html#element-definitions-attributes

https://www.w3.org/TR/html52/dom.html#global-attributes

HTML4 齲齪 id name 齢黁麿麻麺齺齮鼻鼦齇鼒鼋麸齺麶麳鼹鼶鼡麲龚齇鼒鼖鼡齇鼖麮齇齅鼖齝鼐鼏鼖麬鼙鼖鼝鼙齺鼂龒

http://www.w3.org/TR/html4/types.html#type-name

class id 麧麥麣麟 CSS 齲麚麘麗麿齅 identifier CSS 龑龍麧龌 W3C 齽齻龚齺麕齲齢麓麐麌龚麻麺齺鼂龒

https://www.w3.org/TR/CSS21/syndata.html#characters

CSS 麗麿齅齲麄 class id 麃麁鹿鼺鹽 name 齺鹺鹷鹵齛鹱鹰鼦齝麻鹯龒

麮齇齅 - (U+002D)

鹣鹠齇鼒 (U+0030 - U+0039)

鹜鹠齇鼒 (U+0041 - U+005A)

齝鼐鼏 (U+005F)

鼡齇 (U+0061 - U+007A)

ISO 10646 齇齅 U+00A1 鹉麓鹇

鼼鼻鼦鼡齇鼖鹆麮齇齅鼖麮齇齅鹂鼡齇鼋鼉

齹鸾鸻齲鸷鹷鹵齛鹱鹰麓麐麌麓鸳麣龚麻鹯齺麨齹鸾鸯鸾鸭齲鸬鸩鸨鸤齛齗鼼齕齺鸡龚鸝鸚鸙鸕鸔鹱鹰鼦齝麻鹯鸑鸍鸊鸳麣麟鸇齢鸩鸨鸤齺 class id 麻鹯鸃鸁鷾龒

鼦齇鼒 A-Z a-z 鼋麸

麕麶龌齇鼒 (A-Za-z), 鼡齇 (0-9), 麮齇齅 ("-") 鼞齝鼐鼏 ("_")

鷪齎鹜鹣鹠

鷦鼶 class id 鷤鷢龒

HTML5 , 鼧麣麟鼹鷡龚 HTML 鷞鷚 ( 齷鷖鷒鷐鼹鷡 HTML 鷞鷚鷏麨鼼齕麺龌齢麣 )

HTML 4.01 , 鼼鼻麣麟 : <base>, <head>, <html>, <meta>, <param>, <script>, <style>, <title>

drupal8 鹱鹰鼦鷂 css 麗麿齅麻鹯齺齹龱龒 \Drupal\Component\Utility\Html 齲鶾鶼鸃鶸鶷鶶

HTML 鶵鶲龱龒

龱龒 \Drupal\Component\Utility\Html

鶯龱鶫鶪鶩鶧龦 HTML 鶦鶣齢鶸龚鸾麣鶢鶠鷏鶟鶞齠齝龒

\Drupal\Component\Utility\Html::getClass($class)

鶷鶶齕鼩齇齅齄齺 鶘鶔鶓鶠齢鶐龚龱龔齺鶎鶋鶇麣齮鼻鶷鶶齕鼩龱龔齺鼼鼧鼦齑齏齎齊鶆鶃鶧鼩龱龔齺鶷鶶麶龚龱龔麄齅鶓鶂鶀鶟鶞龚麻鹯麃齺鸊鵾鵽鼦齝黁鵼龒

齑齏鼖齝鼐鼏鼖 / [ 鸊麥鵷鵳鵱麮齇齅齺鵭 ] 鵦麥鵣鵠齺鹆齝鼐鼏鵝鵙齺齃鵕麥鵔鵑鵱鹣鹠

\Drupal\Component\Utility\Html::getId($id)

鶷鶶齕鼩齇齅齄齺鶘鶔鶓鶠齢鶐龚 id 齇齅齄齺鵾鵽鼦齝黁鵼龒

齑齏鼖齝鼐鼏鼖 [ 麥麮齇齅鵷鵳齺鶧鼩麮齇齅 - 麥鵷鵳鵱齕鼩齺鼢鹿鼺齇鼒鼖鼡齇鼖麮齇齅齺齃鵕鹣鹠

\Drupal\Component\Utility\Html::getUniqueId($id)

getId($id) 鵍齃鸃鸁齺鼼鶷鵋鵝鷐鼽齕鷢齺齹 html 鵇鵅齲 id 鵃鵁鼽齕齺鶯鴾鼡鸳鶷鴽鹂鴹鼡龚鶢鴵鵝鷐 id 齇齅齄龚鼽齕鷢齺鵾鴴龌龒 id+ -- + 鴹鼡 齺鴹鼡鴳 2 鼋鼉齺鼺 2 齺齠鵭 yunke--2 鵦齺齹鵇鵅齲齠鴭鴬鸭 id 鵾鵽鹆麮齇齅鹂鼡齇齺鴪鴩鴨龌鶯鴾鼡齹鴧鶣麣鹽鴤齠鴭龌 ajax 鴞齗齺龉麟鴛鴘鷖鶓鴗鶔齕鼩鴕鴑龚鵇鵅齺鴪鴩 id 鵱龒 id+ -- +Base64 龚鴋鴇齇齅鴤鶯鶢鶠鸳鴅龉鴁鳾齹鳻鳷鶾鶼齲鶇麣齺齹鶂鳳齠鹵齛鳱麺龚 id 齺鹵齛鳰鳷鳭鳬

齹鶯龱齲麁齢鶸麟 DOM 鶦鶣鼖 html 鸾鴴鵔鵳鼖鳩鳨鵔鵳鼆鶵鶲鶢鶠鸍鳥鼢麘鳢鳡鶟鶞齺鳠麐鴞鳞鷦鳚鶀鳗鷏

\Drupal\Component\Utility\Html::normalize

麻鳖鵑鶀鳗齺鳔齠鳓麄齑鶀鳏鳌鼝鼆

\Drupal\Component\Utility\Html::load

鹂鳉齕鼩 html 鳇鳃齺鳂鲾 \DOMDocument 齪鲼

\Drupal\Component\Utility\Html::serialize

麁鲹 \DOMDocument 齪鲼龚 body html 鳇鳃

\Drupal\Component\Utility\Html::decodeEntities

鲴鲲 html 鸾鴴齺鼢齕鲯

\Drupal\Component\Utility\Html::escape

鸊黁鲫齇齅鵔鵱 html 鸾鴴

\Drupal\Component\Utility\Html::transformRootRelativeUrlsToAbsolute

html 鳇鳃齲龚鸃齪鳩鳨鵔鵳鵱鲦齪鳩鳨

本书共71小节:

评论 (写第一个评论)