XML names/IDs

When you create an instance of any of the Pergola classes you can pass an optional string parameter. If specified, the constructor (more precisely, the Class superclass constructor) uses it to define the object's properties name and (XML conformant) id, which is also used as prefix for the object's descendants IDs. The id attribute is set for the most relevant component elements, but it's never used by any class method (Pergola references instead all the relevant DOM nodes and container layers).

If the parameter is not specified the constructor creates a unique XML name/id. You can use this feature for any object or element.

You normally don't need to use pergola.xmlName properties and methods explicitly, but rather through String.xmlNameGenerator:

 var id = "".xmlNameGenerator();
However, you can invoke explicitly pergola.xmlName.exist() and pergola.xmlName.add() to check and add hardcoded IDs (but do not add an id without testing its existence).



Array – stores all generated IDs.


Checks if string is already used.


Adds string to pergola.xmlName.list.


Removes string from pergola.xmlName.list.