Is JQuery(..).html() buggy in jQuery 1.3.2?

后端 未结 2 782
闹比i
闹比i 2021-01-18 00:36

The code here does not return what one expects:

jQuery(\'
Look here: [ jQuery0=\"null\" ]
\').html()

Rather, you get:

2条回答
  •  佛祖请我去吃肉
    2021-01-18 01:00

    This code is new in 1.3.2, it wasn't in 1.3.1. It looks to me like jQuery uses attributes whose names start with "jQuery" to store data on elements, and this is its way of not exposing that to you when you ask for the html back.

    It clearly isn't a bug. The author intended to remove that HTML before returning you the string.

    Does this affect your code? As with any library, you should test your production code thoroughly before deploying it.

提交回复
热议问题