Script Origin Tracking: Difference between revisions

 
(2 intermediate revisions by 2 users not shown)
Line 26: Line 26:
   { origin:<i>origin</i>, line:<i>line</i>, column:<i>column</i> }
   { origin:<i>origin</i>, line:<i>line</i>, column:<i>column</i> }


where <i>origin</i> is an origin value (described below), <i>line</i> is a one-based line number, and <i>column</i> is a zero-based column number. The <code>column</code> property is optional. The <code>line</code> property may also be omitted if it is not available; simple consumers could treat a missing <code>line</code> as referring to the beginning of the text.
where <i>origin</i> is an origin value (described below), <i>line</i> is a zero-based line number, and <i>column</i> is a zero-based column number. The <code>column</code> property is optional. The <code>line</code> property may also be omitted if it is not available; simple consumers could treat a missing <code>line</code> as referring to the beginning of the text.


A <i>markup location</i> is a location in markup text: a location whose <code>origin</code> is a markup origin. A <i>script location</i> is a location in a script: a location whose <code>origin</code> is a script origin.
A <i>markup location</i> is a location in markup text: a location whose <code>origin</code> is a markup origin. A <i>script location</i> is a location in a script: a location whose <code>origin</code> is a script origin.
Note that <i>line</i> is always relative to the start of the text represented by <i>origin</i>, not relative to whatever documents that may contain <i>origin</i>. For example, if <i>document</i> is an origin describing a document with a <code>&lt;script&gt;</code> element at line 10, then the location
  { line: 5,
    origin: { scriptElement: <i>element</i>,
              markupLocation: { line: 10, origin: <i>document</i> }
            }
  }
represents line 15 of <i>document</i>, or the sixth line of the <code>&lt;script&gt;</code> element.


== Origin values ==
== Origin values ==
Line 108: Line 118:
<dl>
<dl>
<dt>toString()
<dt>toString()
<dd>Format the location or origin value as a human-readable string. In English. <i>&#5b;Author is crushed by gigantic Monty Python-esque weight labeled "localization"&#5d;</i>
<dd>Format the location or origin value as a human-readable string. In English. <i>&#x5b;Author is crushed by gigantic Monty Python-esque weight labeled "localization"&#x5d;</i>
</dl>
</dl>


Line 123: Line 133:
<li>It's possible to provide more details about javascript: URLs: where does the URL appear? Who put it there. But it doesn't seem like it should be a high priority.
<li>It's possible to provide more details about javascript: URLs: where does the URL appear? Who put it there. But it doesn't seem like it should be a high priority.
</ul>
</ul>


jorendorff says:
jorendorff says:
638

edits