[Pas2js] Random bugs and observations
Michael Van Canneyt
michael at freepascal.org
Fri May 11 09:23:17 CEST 2018
On Fri, 11 May 2018, Ryan Joseph wrote:
>
>
>> On May 11, 2018, at 2:07 PM, Michael Van Canneyt <michael at freepascal.org> wrote:
>>
>> Correct, this is not a property of TJSElement.
>>
>> TJSNode has innerText and textContent
>> TJSElement has innerHTML and outerHTML
>
> I got that from the WebGL docs like seen below. I added the property myself and it does in fact return the tags text content. I guess it’s the same as textContent or innerHTML perhaps.
>
> • var vertexShaderSource = document.getElementById("2d-vertex-shader").text;
> • var fragmentShaderSource = document.getElementById("2d-fragment-shader").text;
Now you know why Javascript is not typesafe.
If the actual element returned by document.getElementById has a .text property,
Javascript will happily return it at runtime. It may also be a browser-specific
property.
If no such property exists, you will get undefined.
Michael.
More information about the Pas2js
mailing list