SDK Programmer's Guide
Troubleshooting Tips
Null and undefined values
The SDK returns null when the object it should return does not exist. The SDK returns undefined to
indicate that the accessed property exists but the object it returns does not.
Case sensitivity
In GoLive 6 and higher, the names of JavaScript properties are always case sensitive.
●
The tagName attribute of a custom <jsxelement> element that is an HTML attribute must not
●
contain uppercase characters. GoLive treats tags defined for HTML as lowercase.
HTML is not case-sensitive, but JavaScript is. For example, <img> and <IMG> define the same HTML
●
element, but when you compare tag name values to find these elements in your JavaScript code, case
is considered. This code fragment could fail to recognize an <img> element because of the
case-sensitive string comparison it uses:
var tree = document.documentElement;
var totalElts = tree.getSubElementCount();
}
To avoid this problem, you can do a case-insensitive comparison using the markup object's
getSubElement function. For example, these are equivalent:
document.documentElement.getSubElement ("img");
document.documentElement.getSubElement ("IMG");
Line breaks in palette entries and string literals
The code examples in this book sometimes contain extra line breaks to enhance their readability on the
printed page. If copied literally, these line breaks can interfere with the proper execution of the code
example. In particular, extraneous line breaks in a palette entry can cause it to not function correctly. A
properly constructed palette entry consists of one (possibly very long) line of JavaScript code.
Similarly, you must not include line breaks in your definitions of string literals.
In this example, the line break in the definition of the msg string terminates it prematurely, with the effect
that the alert dialog displays only the first half of the message:
var msg = "Do not include line
Window.alert (msg); // shows only half the message
for (i=0; i < totalElts; i++)
{
var currElt = tree.getSubElement(i);
if (currElt.tagName == "IMG") // fails for <img>, <Img>
{ ... }
breaks in string literal definitions";
Adobe GoLive CS2 SDK
Debugging Scripts
177