I was reading up about DOM and I saw this function DOMCharacterData::appendData. It appends the string data to the character data. So in layman’s terms, what is character data?
I was reading up about DOM and I saw this function DOMCharacterData::appendData . It
Share
It is defined in non layman’s terms in the standard here.
But more simply, character data is any text in the HTML, that isn’t part of a tag. This is in contrast to tags, attributes etc. It can be just typed as text, or defined with a CDATA section in the html, or a comment etc.
Example html:
In the code above “This is all character data” is character data, but the tag surrounding it isn’t. The same goes for the CDATA section and the comment. One thing that often surprises people is that whitespace counts as character data.