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

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

      1. <legend id='s0INK'><style id='s0INK'><dir id='s0INK'><q id='s0INK'></q></dir></style></legend>

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

      2. 使用getAttribute(),還是不使用getAttribute():這是個問

        To use getAttribute(), or not to use getAttribute(): that is the question(使用getAttribute(),還是不使用getAttribute():這是個問題)
          <i id='a51yJ'><tr id='a51yJ'><dt id='a51yJ'><q id='a51yJ'><span id='a51yJ'><b id='a51yJ'><form id='a51yJ'><ins id='a51yJ'></ins><ul id='a51yJ'></ul><sub id='a51yJ'></sub></form><legend id='a51yJ'></legend><bdo id='a51yJ'><pre id='a51yJ'><center id='a51yJ'></center></pre></bdo></b><th id='a51yJ'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='a51yJ'><tfoot id='a51yJ'></tfoot><dl id='a51yJ'><fieldset id='a51yJ'></fieldset></dl></div>

            • <bdo id='a51yJ'></bdo><ul id='a51yJ'></ul>
                <tbody id='a51yJ'></tbody>

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

              • <legend id='a51yJ'><style id='a51yJ'><dir id='a51yJ'><q id='a51yJ'></q></dir></style></legend>

                <tfoot id='a51yJ'></tfoot>
                • 本文介紹了使用getAttribute(),還是不使用getAttribute():這是個問題的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  可能重復:
                  JavaScript setAttribute vs .attribute=
                  javascript dom,如何處理特殊屬性"與屬性相比?

                  很多時候,在論壇或諸如 Usenet 之類的地方,一些人(在批評我的代碼時)告訴我,而不是說,例如 var link = a.href 我應該使用 var link = a.getAttribute('href'); 代替.并在想要賦值時使用它的補充setAttribute().

                  Many times, in forums or places such as Usenet I have been told by some (when criticizing my code) that instead of saying, for example var link = a.href I should use var link = a.getAttribute('href'); instead. And use its complementary setAttribute() when wanting to assign.

                  他們說這是正確的做法,我錯了,等等等等……我通常不會注意那些.當我問為什么沒有人給出真正的答案時.

                  They say it is the correct way to do it, that I am wrong, blah blah blah... I don’t normally pay any attention to those. And when I ask why nobody gives a real answer.

                  現在我很好奇在哪種情況下使用一種或另一種更合適.

                  Now I am curious about in which cases it would be more suitable to use one or another.

                  在什么情況下用 var link = a.getAttribute('href'); 代替 var link = a.href 更合適?
                  在什么情況下我應該使用 setAttribute() 來分配而不是直接通過其標識符為成員分配值?即:`a.href = 'someURL';

                  In what cases would be more suitable to say var link = a.getAttribute('href'); instead of var link = a.href?
                  And in what cases shoulw I use setAttribute() to assign instead of assigning a value to a member directly by its identifier? i.e: `a.href = 'someURL';

                  推薦答案

                  每當有人推薦一種做法時,他們應該始終證明該建議的合理性.

                  Whenever someone recommends a practice they should always justify the advice.

                  不使用 getAttributesetAttribute 的原因比 IE 版本高達并包括 8 至少在這些 DOM 方法的實現中存在錯誤.此外,瀏覽器在如何更改 DOM 屬性以響應 get/setAttribute 的使用方面也存在差異.

                  Reasons for not using getAttribute and setAttribute are than IE versions up to and including 8 at least have bugs in their implementation of those DOM methods. Also, browsers have differences in how they change DOM properties in response to the use of get/setAttribute.

                  但是,瀏覽器在 DOM 屬性方面非常一致,因此如果使用 DOM 屬性,編寫跨瀏覽器代碼要簡單得多.唯一需要注意的是,一些瀏覽器不會為非標準 HTML 屬性創建 DOM 屬性,但它們都會使用屬性來設置它們.

                  However, browsers are remarkably consistent in regard to DOM properties, so it is much simpler to write cross browser code if you use DOM properties. The only caveat is that some browsers do not create DOM properties for non-standard HTML attributes, but they will all set them using properties.

                  另外一個好處是 DOM 屬性訪問比使用函數調用 get/setAttribute 快得多.

                  An added bonus is that DOM property access is much faster than using a function call to get/setAttribute.

                  HTML5 正試圖將其中一些行為標準化,但 HTML5 的問題在于它不是 W3C 標準(而且可能永遠不會是),它是嘗試的活規范"不僅要記錄瀏覽器的功能(或多或少),還要記錄其作者希望他們做什么而不區分兩者.因此,雖然它作為一種竣工"規范和愿望清單很有幫助,但作為標準卻毫無用處.

                  HTML5 is attempting to standardise some of these behaviours, but the problem with HTML5 is that it is not a W3C standard (and may never be) and that it is a "living specification" that attempts to not only document what browsers do (more or less) but also what its authors would like them to do without distinguishing between the two. So while it is helpful as a kind of "as built" specification plus wish list, it is quite useless as a standard.

                  W3C 已經發布 HTML 5 規范 有一段時間了(包括編號版本和列表更改),并且 WHATWG 還發布 HTML 和 DOM 標準幾乎每天更新,但沒有說明發生了什么變化.一個或另一個最終可能會放棄.

                  The W3C has been publishing HTML 5 specifications for a while now (including numbered versions and lists of changes), and the WHATWG also publishes HTML and DOM standards with almost daily updates but without indicating what has changed. One or the other may give up eventually.

                  這篇關于使用getAttribute(),還是不使用getAttribute():這是個問題的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

                  Use IScroll in Angular 2 / Typescript(在 Angular 2/Typescript 中使用 IScroll)
                  anime.js not working in Ionic 3 project(Anime.js 在 Ionic 3 項目中不起作用)
                  Ionic 3 - Update Observable with Asynchronous Data(Ionic 3 - 使用異步數據更新 Observable)
                  Angular 2: file not found on local .json file(Angular 2:在本地 .json 文件中找不到文件)
                  In Ionic 2, how do I create a custom directive that uses Ionic components?(在 Ionic 2 中,如何創建使用 Ionic 組件的自定義指令?)
                  Use ViewChild for dynamic elements - Angular 2 amp; ionic 2(將 ViewChild 用于動態元素 - Angular 2 amp;離子2)
                  • <bdo id='vqYA0'></bdo><ul id='vqYA0'></ul>

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

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

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

                            <tbody id='vqYA0'></tbody>
                          <tfoot id='vqYA0'></tfoot>
                            主站蜘蛛池模板: 日韩视频免费看 | 精品久久久久香蕉网 | 妹子干综合 | 黄色一级毛片 | 日韩毛片在线观看 | 亚洲国产精品一区 | 黄色片网站国产 | 成人视屏在线观看 | 日日操操 | 国产伦精品一区二区三区高清 | 久久久国产一区二区三区 | 91高清在线观看 | 欧美成人一区二区三区 | 91国在线高清视频 | 男人天堂午夜 | 天天操天天摸天天爽 | 国产一级片91| jizjizjiz中国护士18 | 国产黄色小视频在线观看 | 九九亚洲 | 欧美日韩看片 | 免费精品在线视频 | 成人性生交大片免费看r链接 | 亚洲欧美自拍偷拍视频 | 金莲网 | 日韩手机在线看片 | 精品自拍视频在线观看 | 蜜桃av一区二区三区 | 欧美精品在线免费观看 | 成年人免费网站 | 日本一区视频在线观看 | 请别相信他免费喜剧电影在线观看 | 国产精品国产成人国产三级 | 成人在线视频网 | 日本精品视频一区二区 | 久久国产精品视频 | 久久不卡日韩美女 | 一区二区三区中文字幕 | 成人精品久久 | 国产精品亚洲一区二区三区在线 | 成人免费视频 |