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 鳇鳆齦龔鷵齠鳥鳤鵏鵤鵣鲭齠鳥鳤

本书共83小节:

评论 (写第一个评论)