五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

Vue3+Vite+Vant-UI 開發(fā)雙端招聘APP [獨(dú)家首發(fā)持續(xù)更新]

2023-08-14 12:09 作者:bili_51805000088  | 我要投稿

Vue3+Vite+Vant-UI 開發(fā)雙端招聘APP [獨(dú)家首發(fā)持續(xù)更新]

download:https://www.zxit666.com/6479/

解析 CSS 規(guī)則?parseRule()

private parseRule() { ? ?const rule: Rule = { ? ? ? ?selectors: [], ? ? ? ?declarations: [], ? ?} ? ?rule.selectors = this.parseSelectors() ? ?rule.declarations = this.parseDeclarations() ? ?return rule }

在?parseRule()?里,它分別調(diào)用了?parseSelectors()?去解析 CSS 選擇器,然后再對(duì)剩余的 CSS 文本執(zhí)行?parseDeclarations()?去解析 CSS 屬性。

解析選擇器?parseSelector()

private parseSelector() { ? ?const selector: Selector = { ? ? ? ?id: '', ? ? ? ?class: '', ? ? ? ?tagName: '', ? ?} ? ?switch (this.rawText[this.index]) { ? ? ? ?case '.': ? ? ? ? ? ?this.index++ ? ? ? ? ? ?selector.class = this.parseIdentifier() ? ? ? ? ? ?break ? ? ? ?case '#': ? ? ? ? ? ?this.index++ ? ? ? ? ? ?selector.id = this.parseIdentifier() ? ? ? ? ? ?break ? ? ? ?case '*': ? ? ? ? ? ?this.index++ ? ? ? ? ? ?selector.tagName = '*' ? ? ? ? ? ?break ? ? ? ?default: ? ? ? ? ? ?selector.tagName = this.parseIdentifier() ? ?} ? ?return selector }private parseIdentifier() { ? ?let result = '' ? ?while (this.index < this.len && this.identifierRE.test(this.rawText[this.index])) { ? ? ? ?result += this.rawText[this.index++] ? ?} ? ?this.sliceText() ? ?return result }

選擇器我們只支持標(biāo)簽稱號(hào)、前綴為?#?的 ID 、前綴為恣意數(shù)量的類名?.?或上述的某種組合。假如標(biāo)簽稱號(hào)為?*,則表示它是一個(gè)通用選擇器,能夠匹配任何標(biāo)簽。

規(guī)范的 CSS 解析器在遇到無(wú)法辨認(rèn)的局部時(shí),會(huì)將它丟掉,然后繼續(xù)解析其他局部。主要是為了兼容舊閱讀器和避免發(fā)作錯(cuò)誤招致程序中綴。我們的 CSS 解析器為了完成簡(jiǎn)單,沒(méi)有做這方面的做錯(cuò)誤處置。

解析 CSS 屬性?parseDeclaration()

private parseDeclaration() { ? ?const declaration: Declaration = { name: '', value: '' } ? ?this.removeSpaces() ? ?declaration.name = this.parseIdentifier() ? ?this.removeSpaces() ? ?while (this.index < this.len && this.rawText[this.index] !== ':') { ? ? ? ?this.index++ ? ?} ? ?this.index++ // clear : ? ?this.removeSpaces() ? ?declaration.value = this.parseValue() ? ?this.removeSpaces() ? ?return declaration }

parseDeclaration()?會(huì)將?color: red;?解析為一個(gè)對(duì)象?{ name: "color", value: "red" }。

小結(jié)

CSS 解析器相對(duì)來(lái)說(shuō)簡(jiǎn)單多了,由于很多學(xué)問(wèn)點(diǎn)在 HTML 解析器中曾經(jīng)講到。整個(gè) CSS 解析器的代碼大約 100 多行,假如你閱讀過(guò) HTML 解析器的源碼,置信看 CSS 解析器的源碼會(huì)更輕松。


Vue3+Vite+Vant-UI 開發(fā)雙端招聘APP [獨(dú)家首發(fā)持續(xù)更新]的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
黔西县| 东辽县| 志丹县| 丹凤县| 临沭县| 肇东市| 襄汾县| 武乡县| 鞍山市| 桐庐县| 澜沧| 五莲县| 专栏| 达尔| 班玛县| 沧源| 金秀| 景洪市| 长葛市| 兰坪| 台中市| 大姚县| 泰宁县| 革吉县| 南安市| 弥渡县| 兴国县| 察隅县| 山阴县| 合作市| 孝感市| 谢通门县| 林口县| 新津县| 安西县| 香港| 杭锦后旗| 朝阳市| 长寿区| 皋兰县| 司法|