久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<small id='YuBjt'></small><noframes id='YuBjt'>

      1. <legend id='YuBjt'><style id='YuBjt'><dir id='YuBjt'><q id='YuBjt'></q></dir></style></legend>
      2. <tfoot id='YuBjt'></tfoot>
        <i id='YuBjt'><tr id='YuBjt'><dt id='YuBjt'><q id='YuBjt'><span id='YuBjt'><b id='YuBjt'><form id='YuBjt'><ins id='YuBjt'></ins><ul id='YuBjt'></ul><sub id='YuBjt'></sub></form><legend id='YuBjt'></legend><bdo id='YuBjt'><pre id='YuBjt'><center id='YuBjt'></center></pre></bdo></b><th id='YuBjt'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='YuBjt'><tfoot id='YuBjt'></tfoot><dl id='YuBjt'><fieldset id='YuBjt'></fieldset></dl></div>
          <bdo id='YuBjt'></bdo><ul id='YuBjt'></ul>

        為什么我應(yīng)該在我的自定義屬性前面加上“data

        Why should I prepend my custom attributes with quot;data-quot;?(為什么我應(yīng)該在我的自定義屬性前面加上“data-?)
        <tfoot id='Vt0zi'></tfoot>

          <legend id='Vt0zi'><style id='Vt0zi'><dir id='Vt0zi'><q id='Vt0zi'></q></dir></style></legend>

          <small id='Vt0zi'></small><noframes id='Vt0zi'>

          <i id='Vt0zi'><tr id='Vt0zi'><dt id='Vt0zi'><q id='Vt0zi'><span id='Vt0zi'><b id='Vt0zi'><form id='Vt0zi'><ins id='Vt0zi'></ins><ul id='Vt0zi'></ul><sub id='Vt0zi'></sub></form><legend id='Vt0zi'></legend><bdo id='Vt0zi'><pre id='Vt0zi'><center id='Vt0zi'></center></pre></bdo></b><th id='Vt0zi'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Vt0zi'><tfoot id='Vt0zi'></tfoot><dl id='Vt0zi'><fieldset id='Vt0zi'></fieldset></dl></div>
            <tbody id='Vt0zi'></tbody>
                • <bdo id='Vt0zi'></bdo><ul id='Vt0zi'></ul>
                  本文介紹了為什么我應(yīng)該在我的自定義屬性前面加上“data-"?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  所以我使用的任何自定義數(shù)據(jù)屬性都應(yīng)該以data-"開頭:

                  So any custom data attribute that I use should start with "data-":

                  <li class="user" data-name="John Resig" data-city="Boston"
                       data-lang="js" data-food="Bacon">
                    <b>John says:</b> <span>Hello, how are you?</span>
                  </li>
                  

                  如果我忽略這一點,會有什么不好的事情發(fā)生嗎?即:

                  Will anything bad happen if I just ignore this? I.e.:

                  <li class="user" name="John Resig" city="Boston"
                       lang="js" food="Bacon">
                    <b>John says:</b> <span>Hello, how are you?</span>
                  </li>
                  

                  我想一件壞事是我的自定義屬性可能與具有特殊含義的 HTML 屬性沖突(例如,name),但除此之外,只寫example_text"是否有問題數(shù)據(jù)示例文本"?(它不會驗證,但誰在乎呢?)

                  I guess one bad thing is that my custom attributes could conflict with HTML attributes with special meanings (e.g., name), but aside from this, is there a problem with just writing "example_text" instead of "data-example_text"? (It won't validate, but who cares?)

                  推薦答案

                  保持自定義屬性以 data-* 為前綴有幾個好處.

                  There are several benefit for keeping custom attributes prefixed with data-*.

                  1. 它保證在以后的版本中不會與 HTML 的擴展發(fā)生任何沖突.這是一個在某種程度上已經(jīng)在 HTML5 中引入的一些新屬性遇到的問題,其中現(xiàn)有站點使用具有相同名稱的屬性并期望不同且不兼容的自定義行為.(例如,已知 input 元素上的 required 屬性在過去曾在一些流行網(wǎng)站上發(fā)生過沖突)

                  1. It guarantees there will not be any clashes with extensions to HTML in future editions. This is a problem that has been encountered to some degree already with some of the new attributes introduced in HTML5, where existing sites were using attributes with the same name and expecting different and incompatible, custom behaviour. (e.g. the required attribute on input elements is known to have had some clashes on some popular websites in the past)

                  有一個方便的 DOM API,HTMLElement.dataset,用于從腳本訪問這些屬性.現(xiàn)在大多數(shù)瀏覽器都支持.

                  There is a convenient DOM API, HTMLElement.dataset, for accessing these attributes from scripts. It is now supported in most browsers.

                  它們清楚地表明哪些屬性是自定義屬性,哪些是標(biāo)準(zhǔn)化屬性.這不僅通過允許驗證器允許具有 data-* 的任何屬性同時仍然對其他屬性執(zhí)行有用的錯誤檢查(例如捕獲拼寫錯誤)來幫助驗證器,它還有助于使源代碼的這一方面對閱讀它的人來說更加清晰,包括人們誰可以在原作者之后在網(wǎng)站上工作.

                  They provide a clear indication of which attributes are custom attributes, and which ones are standardised attributes. This not only helps validators by allowing them to permit any attribute with data-* while still performing useful error checking for other attributes (e.g. to catch typos), it also helps make this aspect of the source code clearer to those reading it, including people who may work on a website after the original author.

                  這篇關(guān)于為什么我應(yīng)該在我的自定義屬性前面加上“data-"?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  Angular 2: file not found on local .json file(Angular 2:在本地 .json 文件中找不到文件)
                  Input validation with pattern Angular 2(使用模式 Angular 2 進行輸入驗證)
                  How to change the css class name dynamically in angular 2(如何在角度2中動態(tài)更改css類名)
                  How to remove default color in input type?(如何刪除輸入類型中的默認(rèn)顏色?)
                  How to add click event to dynamically added html element in typescript(如何將點擊事件添加到打字稿中動態(tài)添加的html元素)
                  XPath one of multiple attribute values with condition(XPath 具有條件的多個屬性值之一)

                  <legend id='otbGQ'><style id='otbGQ'><dir id='otbGQ'><q id='otbGQ'></q></dir></style></legend>
                • <i id='otbGQ'><tr id='otbGQ'><dt id='otbGQ'><q id='otbGQ'><span id='otbGQ'><b id='otbGQ'><form id='otbGQ'><ins id='otbGQ'></ins><ul id='otbGQ'></ul><sub id='otbGQ'></sub></form><legend id='otbGQ'></legend><bdo id='otbGQ'><pre id='otbGQ'><center id='otbGQ'></center></pre></bdo></b><th id='otbGQ'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='otbGQ'><tfoot id='otbGQ'></tfoot><dl id='otbGQ'><fieldset id='otbGQ'></fieldset></dl></div>
                          <tfoot id='otbGQ'></tfoot>
                          • <bdo id='otbGQ'></bdo><ul id='otbGQ'></ul>
                              <tbody id='otbGQ'></tbody>

                            <small id='otbGQ'></small><noframes id='otbGQ'>

                          • 主站蜘蛛池模板: 久久婷婷香蕉热狠狠综合 | 免费视频一区二区 | 亚洲视频精品 | 久久久新视频 | 亚洲在线一区 | 午夜影院在线观看 | 精品久久国产 | 亚洲三级在线观看 | 国产精品91久久久久久 | 91精品国产综合久久久久久首页 | av在线免费网站 | 97精品超碰一区二区三区 | www亚洲成人 | 欧美一级二级在线观看 | 黄色大片在线 | 久久综合一区 | 91视视频在线观看入口直接观看 | 夜夜骚| 亚洲精品一区在线 | 国产精品大片在线观看 | 国产不卡视频 | 免费在线一区二区 | 一级毛片视频 | 午夜视频在线免费观看 | 欧美激情亚洲天堂 | 亚洲www啪成人一区二区 | 中文字幕国产视频 | 国产欧美日韩久久久 | www.国产 | 在线视频一区二区三区 | 91精品久久久久久久久 | 国产精品久久久久久久久久久久久 | 国产精品三级久久久久久电影 | 成人免费视频在线观看 | 免费黄色a视频 | 欧美黄色精品 | 成人性生交大片免费看r链接 | 成人深夜福利 | 国产精品久久久久久久久久久新郎 | 国产原创在线观看 | 一区二区三区视频在线观看 |