Where does HTML 'id' attribute map to in the DOM?
Posted: Fri Dec 07, 2018 11:51 pm
Suppose I have a simple HTML file like so:
Notice how some paragraphs (and in HTML potentially many/most elements) have an “id” attribute here. The third paragraph then contains a link to a paragraph in a different file.
Loading this file into Office and browsing around its DOM, I am unable to find where the “id” attribute is stored for the paragraph. Not quite sure which interface or service would give me access to that value—if any. Some help would be good, short of digging into the source code for the HTML filter…
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Title</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link href="../style/stylesheet.css" type="text/css" rel="stylesheet"/>
</head>
<body class="b">
<p id="p-001" class="par">Content</p>
<p class="par">Some bla</p>
<!-- A reference to a paragraph in a neighboring file. -->
<p id="id=p-003" class="par">…<a href="../text/page-2.html#p-021" class="link">Link</a>…</p>
…
<!-- An internal reference to a paragraph in this file. -->
<p id="id=p-009" class="par">…<a href="#p-001" class="link">Top</a>…</p>
…
</body>
</html>
Loading this file into Office and browsing around its DOM, I am unable to find where the “id” attribute is stored for the paragraph. Not quite sure which interface or service would give me access to that value—if any. Some help would be good, short of digging into the source code for the HTML filter…