“双引号"是什么意思?在铬意味着什么?(这很奇怪) [英] What does "double quotes" mean in chrome ? (This is weird)

查看:75
本文介绍了“双引号"是什么意思?在铬意味着什么?(这很奇怪)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到Google Chrome浏览器将元素的内部文本包装在双引号中,但是,Html()Jquery函数返回不带引号的字符串.为什么会这样?

这是一些实验:

HTML代码:

 < p id ="simple-text">这是一个简单的段落.< p id ="lorem-text"> Lorem ipsum dolor坐着,奉献爱国,sius do eiusmod tempor indicidunt ut Labore et dolore magna aliqua.尽量不要抽烟,不要因抽烟而锻炼.Duis aute irure dolor in reprehenderit in voltate velit esse cillum dolore eu fugiat nulla pariatur.

p

p

p

p

p

p

和pp,pf,fp,fp,fp,fp,pb,pb,pb,p3,p3,p3,p3,p3,p3,p3,p3,p3,p3和p3的数量均不相同.< p id ="span-text">这是一个简单的< span> span元素</span></p>段落.

Chrome浏览器中的结果(Elements):

注意:简单文本(#simple-text)中没有双引号

使用Jquery(控制台)在Chrome中生成结果:

注意:跨度文本(#span-text)中没有双引号

更新(编辑HTML):

我能说一下三个元素:字符串,跨度和字符串吗?

解决方案

引号实际上不是DOM的一部分,它只是DevTools中的UX功能,表明它是您正在查看的字符串.

如果右键单击该元素并选择 Edit HTML ,您将看到原始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 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 ?

解决方案

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.

这篇关于“双引号"是什么意思?在铬意味着什么?(这很奇怪)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆