• <fieldset id="8imwq"><menu id="8imwq"></menu></fieldset>
  • <bdo id="8imwq"><input id="8imwq"></input></bdo>
    最新文章專題視頻專題問答1問答10問答100問答1000問答2000關鍵字專題1關鍵字專題50關鍵字專題500關鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關鍵字專題關鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
    問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
    當前位置: 首頁 - 科技 - 知識百科 - 正文

    再談querySelector和querySelectorAll的區別與聯系_javascript技巧

    來源:懂視網 責編:小采 時間:2020-11-27 21:02:53
    文檔

    再談querySelector和querySelectorAll的區別與聯系_javascript技巧

    再談querySelector和querySelectorAll的區別與聯系_javascript技巧:先按W3C的規范來說這兩個方法應該返回的內容吧: querySelector: return the first matching Element node within the node's subtrees. If there is no such node, the method must return null.(返回指定元素節
    推薦度:
    導讀再談querySelector和querySelectorAll的區別與聯系_javascript技巧:先按W3C的規范來說這兩個方法應該返回的內容吧: querySelector: return the first matching Element node within the node's subtrees. If there is no such node, the method must return null.(返回指定元素節

    先按W3C的規范來說這兩個方法應該返回的內容吧:
    querySelector:

    return the first matching Element node within the node's subtrees. If there is no such node, the method must return null.(返回指定元素節點的子樹中匹配selector的集合中的第一個,如果沒有匹配,返回null)

    querySelectorAll:

    return a NodeList containing all of the matching Element nodes within the node's subtrees, in document order. If there are no such nodes, the method must return an empty NodeList. (返回指定元素節點的子樹中匹配selector的節點集合,采用的是深度優先預查找;如果沒有匹配的,這個方法返回空集合)

    使用方法:
    代碼如下:
    var element = baseElement.querySelector(selectors);
    var elementList = baseElement.querySelectorAll(selectors);

    這在BaseElement 為document的時候,沒有什么問題,各瀏覽器的實現基本一致;但是,當BaseElement 為一個普通的dom Node的時候(支持這兩個方法的dom Node),瀏覽器的實現就有點奇怪了,舉個例子:
    代碼如下:

    Test



    聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

    文檔

    再談querySelector和querySelectorAll的區別與聯系_javascript技巧

    再談querySelector和querySelectorAll的區別與聯系_javascript技巧:先按W3C的規范來說這兩個方法應該返回的內容吧: querySelector: return the first matching Element node within the node's subtrees. If there is no such node, the method must return null.(返回指定元素節
    推薦度:
    • 熱門焦點

    最新推薦

    猜你喜歡

    熱門推薦

    專題
    Top
    主站蜘蛛池模板: HEYZO无码综合国产精品| 精品国产欧美一区二区| 99爱在线精品免费观看| 午夜精品久久影院蜜桃| 99精品国产福利在线观看| 国产麻豆精品一区二区三区v视界| 欧美人与动牲交a欧美精品| 国产高清在线精品一区小说| 国产精品怡红院永久免费| 国产精品久久久久国产A级| 自拍偷自拍亚洲精品第1页| 精品国产亚洲男女在线线电影| 亚洲国产成人久久精品影视| A级精品国产片在线观看| 久久精品黄AA片一区二区三区| 亚洲欧美国产精品第1页| 久久99热这里只有精品国产| 国产精品无码久久久久| 98香蕉草草视频在线精品看| 久久国产乱子精品免费女| 成人午夜精品网站在线观看| 国产精品国色综合久久| 精品亚洲A∨无码一区二区三区| 亚洲精品成人片在线观看精品字幕| 日韩精品无码免费视频| 久久99精品久久久久久9蜜桃 | 国产伦精品一区二区三区| 亚洲精品成人无限看| 欧美精品亚洲精品日韩传电影| 亚洲av日韩精品久久久久久a| 亚洲综合欧美精品一区二区| 在线亚洲欧美中文精品| 亚洲韩国精品无码一区二区三区 | 国产AV国片精品有毛| 97久久超碰国产精品2021| 国产精品熟女一区二区| 91精品国产91久久综合| 国产精品日韩欧美制服| 国产精品久久久久久| 热99re久久国超精品首页| 久久国产精品久久|