Is it possible to use HTML's .querySelector() to select by xlink attribute in an SVG?

前端 未结 3 1423
無奈伤痛
無奈伤痛 2020-11-30 04:39

Given:


    
        <         


        
3条回答
  •  感动是毒
    2020-11-30 05:08

    [*|href] will match both html href and svg xlink:href, then use :not([href]) to exclude html href.

    document.querySelectorAll('[*|href]:not([href])')
    

    tested in chrome

提交回复
热议问题