JQuery_2.1.0_日記 5.4 Sizzle選取器(二)

來源:互聯網
上載者:User

標籤:style   blog   class   code   java   c   

(1)
whitespace = "[\\x20\\t\\r\\n\\f]";
匹配css3中空白符.\x20:空格;\t水平定位字元(tab);\r\n斷行符號換行\f換頁符
(2)
characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+"
匹配\後任一字元,字母或數字或-,ascii值非\00-\xa0範圍內的字元
(3)
identifier = characterEncoding.replace( "w" , "w#" )
匹配\後任一字元,字母或數字或#或-,ascii值非\00-\xa0範圍內的字元
(4)
attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace +               "*(?:([*^$|!~]?=)" + whitespace + "*(?:([‘\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]"
   匹配屬性選取器,例如:[arr^=‘val‘]   擷取的群組1:characterEncoding :匹配例子中arr   擷取的群組2:([*^$|!~]?=):匹配例子中^=   擷取的群組3:[‘\"]:匹配例子中‘   擷取的群組4:(?:\\\\.|[^\\\\])*? 解釋一下這個外層捕獲\和後面的任意數量字元或非\字元,內層有?:是不捕獲的,匹配例子中的val   擷取的群組5:匹配identifier,匹配[id=#a]的情況(5)
pseudos = ":(" + characterEncoding + ")(?:\\((([‘\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)"
   匹配偽類運算式,例如li:nth-child(2n+1)   擷取的群組1:characterEncoding :匹配例子中nth-child   擷取的群組2:匹配例子中的2n+1   擷取的群組3:匹配‘ or "   擷取的群組4:匹配\和後面任何字元或非\字元   擷取的群組5:匹配不再‘ or "內的\和後面任一字元或非\()[]字元或attributes
(6)
rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" )
   捕獲 > + ~ 關係符(7)
rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]‘\"]*?)" + whitespace + "*\\]" , "g" )
    匹配=[非‘非"]

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.