开发者

The term for the text between the opening and the closing tag?

开发者 https://www.devze.com 2023-02-03 10:44 出处:网络
In <span>foo</span> what\'s the proper term to refer to f开发者_开发问答oo?From the W3C XML Specification:

In <span>foo</span> what's the proper term to refer to f开发者_开发问答oo?


From the W3C XML Specification:

Definition: The text between the start-tag and end-tag is called the element's content


The content of the text child node of the <span> element.

See quirksmode on this:

So if you do

<P>This is a paragraph</P>

you have created two nodes: an element P and a text node with content 'This is a paragraph'. The text node is inside the element, so it is considered a child node of the element.


Personally I call it content or text

The content in the span is foo

This sounds correct IMO.


Quoting from w3schools

An XML element is everything from (including) the element's start tag to 
(including) the element's end tag.    
An element can contain other elements, simple text or a mixture of both.
Elements can also have attributes.

<bookstore>
  <book category="CHILDREN">
    <title>Harry Potter</title>
    <author>J K. Rowling</author>
    <year>2005</year>
    <price>29.99</price>
  </book>
  <book category="WEB">
    <title>Learning XML</title>
    <author>Erik T. Ray</author>
    <year>2003</year>
    <price>39.95</price>
  </book>
</bookstore> 

In the example above, <bookstore> and <book> have element 
contents, because they contain other elements. <author> has 
text content because it contains text.

So, "text content"


I'd refer to it either as "content" or "text".

Given HTML as a markup language, you could also refer to it as "the described".


Depends on context, to me.

In Javascript it would be the innerHTML property.

In HTML it is simply content:

  • <span> is the start tag
  • foo is content
  • </span> is the end tag
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号