How does this polyfill work for document.queryselectorall?

前端 未结 1 1022
我寻月下人不归
我寻月下人不归 2021-01-27 04:54

I\'m trying to understand this polyfill for queryselectorall? Specifially this line:

styleTag.styleSheet.cssText = selector + \"{x:expression(document.__qsaels.         


        
1条回答
  •  故里飘歌
    2021-01-27 05:21

    It is abusing the expression "feature" of CSS. When computing the style of the x property (which happens on the reflow triggered by scrollBy(0, 0)), Internet Explorer will execute this snippet for all elements that match the selector.

    CSS expressions are officially despised since IE 8…

    0 讨论(0)
提交回复
热议问题