What does “double quotes” mean in chrome ? (This is weird)

ε祈祈猫儿з 提交于 2021-02-17 05:20:07

问题


I've noticed that Google Chrome wraps inner text of elements in double quotes, however, the Html() Jquery function returns a string without quotes . Why is that ?

And here are some experiments :

Html Code :

<p id="simple-text">This is a simple paragraph .</p>

<p id="lorem-text">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>

<p id="span-text">This is a simple <span>span element</span> paragraph .</p>

Result in Chrome ( Elements ):

Note: There are no double quotes in the simple text (#simple-text)

Result in Chrome using Jquery ( Console ):

Note: There are no double quotes in the span text (#span-text)

Update (Editing Html) :

Could I say that there are three elements : string, span, and a string ?


回答1:


The quotes aren't actually a part of the DOM, it's just a UX feature in DevTools to indicate it's a string you're looking at.

If you right click the element and select Edit HTML, you'll see the raw HTML.



来源:https://stackoverflow.com/questions/49390905/what-does-double-quotes-mean-in-chrome-this-is-weird

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!