admin管理员组文章数量:1024026
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 modo 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 ?
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 modo 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 ?
Share Improve this question edited Mar 20, 2018 at 18:10 CryptoBird asked Mar 20, 2018 at 17:42 CryptoBirdCryptoBird 5561 gold badge5 silver badges24 bronze badges 3-
2
In that last picture, all of the inner HTML is undefined because
innerHtml
isn't actually a property, it should beinnerHTML
– Sidney Commented Mar 20, 2018 at 17:48 - @Sidney : Thanks man – CryptoBird Commented Mar 20, 2018 at 17:50
- The Chrome console pretty much does whatever the developers want it to do. It's trying to be helpful but there are lots of similar questions about how the console presents information. – Pointy Commented Mar 20, 2018 at 17:52
1 Answer
Reset to default 9The 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.
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 modo 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 ?
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 modo 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 ?
Share Improve this question edited Mar 20, 2018 at 18:10 CryptoBird asked Mar 20, 2018 at 17:42 CryptoBirdCryptoBird 5561 gold badge5 silver badges24 bronze badges 3-
2
In that last picture, all of the inner HTML is undefined because
innerHtml
isn't actually a property, it should beinnerHTML
– Sidney Commented Mar 20, 2018 at 17:48 - @Sidney : Thanks man – CryptoBird Commented Mar 20, 2018 at 17:50
- The Chrome console pretty much does whatever the developers want it to do. It's trying to be helpful but there are lots of similar questions about how the console presents information. – Pointy Commented Mar 20, 2018 at 17:52
1 Answer
Reset to default 9The 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.
本文标签: javascriptWhat does quotdouble quotesquot mean in chrome(This is weird)Stack Overflow
版权声明:本文标题:javascript - What does "double quotes" mean in chrome ? (This is weird) - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745545583a2155378.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论