久久久久久久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():這是個(gè)問(wèn)

        To use getAttribute(), or not to use getAttribute(): that is the question(使用getAttribute(),還是不使用getAttribute():這是個(gè)問(wèn)題)
          <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():這是個(gè)問(wèn)題的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

                  問(wèn)題描述

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

                  很多時(shí)候,在論壇或諸如 Usenet 之類的地方,一些人(在批評(píng)我的代碼時(shí))告訴我,而不是說(shuō),例如 var link = a.href 我應(yīng)該使用 var link = a.getAttribute('href'); 代替.并在想要賦值時(shí)使用它的補(bǔ)充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.

                  他們說(shuō)這是正確的做法,我錯(cuò)了,等等等等……我通常不會(huì)注意那些.當(dāng)我問(wèn)為什么沒(méi)有人給出真正的答案時(shí).

                  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.

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

                  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 更合適?
                  在什么情況下我應(yīng)該使用 setAttribute() 來(lái)分配而不是直接通過(guò)其標(biāo)識(shí)符為成員分配值?即:`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';

                  推薦答案

                  每當(dāng)有人推薦一種做法時(shí),他們應(yīng)該始終證明該建議的合理性.

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

                  不使用 getAttributesetAttribute 的原因比 IE 版本高達(dá)并包括 8 至少在這些 DOM 方法的實(shí)現(xiàn)中存在錯(cuò)誤.此外,瀏覽器在如何更改 DOM 屬性以響應(yīng) 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 屬性,編寫(xiě)跨瀏覽器代碼要簡(jiǎn)單得多.唯一需要注意的是,一些瀏覽器不會(huì)為非標(biāo)準(zhǔn) HTML 屬性創(chuàng)建 DOM 屬性,但它們都會(huì)使用屬性來(lái)設(shè)置它們.

                  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.

                  另外一個(gè)好處是 DOM 屬性訪問(wèn)比使用函數(shù)調(diào)用 get/setAttribute 快得多.

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

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

                  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 已經(jīng)發(fā)布 HTML 5 規(guī)范 有一段時(shí)間了(包括編號(hào)版本和列表更改),并且 WHATWG 還發(fā)布 HTML 和 DOM 標(biāo)準(zhǔn)幾乎每天更新,但沒(méi)有說(shuō)明發(fā)生了什么變化.一個(gè)或另一個(gè)最終可能會(huì)放棄.

                  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.

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

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

                  相關(guān)文檔推薦

                  Use IScroll in Angular 2 / Typescript(在 Angular 2/Typescript 中使用 IScroll)
                  anime.js not working in Ionic 3 project(Anime.js 在 Ionic 3 項(xiàng)目中不起作用)
                  Ionic 3 - Update Observable with Asynchronous Data(Ionic 3 - 使用異步數(shù)據(jù)更新 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 中,如何創(chuàng)建使用 Ionic 組件的自定義指令?)
                  Use ViewChild for dynamic elements - Angular 2 amp; ionic 2(將 ViewChild 用于動(dòng)態(tài)元素 - 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>
                            主站蜘蛛池模板: 日韩欧美视频免费在线观看 | 精品乱码一区二区三四区视频 | 亚洲国产aⅴ成人精品无吗 综合国产在线 | 最新av中文字幕 | 日韩在线h | 国产美女免费视频 | 日本精品一区二区 | 欧美舔穴 | 中文字幕一区在线 | 欧美国产日韩一区 | 91精品国产91久久久久久最新 | 亚洲精品国产a久久久久久 午夜影院网站 | 天天插天天搞 | 北条麻妃99精品青青久久 | 国产成人av在线播放 | 国产情侣激情 | www日本在线 | 欧美成人性生活 | 日本黄色大片免费 | 中文字幕一区二区在线观看 | 久草色播 | 日韩欧美视频免费在线观看 | 久久a久久 | 欧美色性| 欧美精品综合在线 | 天天天操 | 午夜精品久久久 | 国产激情视频在线免费观看 | 国产成人在线视频播放 | 中文字幕一区二区三区在线观看 | 看黄在线 | 成人高清视频在线观看 | 免费成人在线网站 | 亚洲精品欧美一区二区三区 | 福利网址 | 亚洲精品久久久9婷婷中文字幕 | 国产精品毛片久久久久久久 | 国产成人精品999在线观看 | 国产黄色大片 | av片网| 久久不卡视频 |