Top

namespace smx

Global smx namespace, one namespace to hold the whole framework.

The smx namespace can serves also as namespace function, see smx().

Details:
Version:
  • 2.1

Classes

Modules

Members

version:String

  • protected
  • static

Gets current framework version.

document:smx.Document

  • protected
  • static

Current active document.

documents:Array.<smx.Document>

  • protected
  • static

Array of loaded documents.

modules:Array

  • protected
  • static

Namescape for custom modules, may extend smx core Classes and provide new processing layers to be applied during the XML loading process. This array is protected and should be controlled only be the registerModule method.

Methods

registerModule()

  • static

Registers a new module. Will add it to modules collection and will also extend smx core classes if the module defines any extension.

smx([s]) → {smx.Node|Array.<smx.Nodes>}

  • static

Global node wrapper, an useful shortcut for interacting with the current active document.

Notice that this method is a namespace function, is private inner function attached directly onto smx namespace. Dont try to call this function as a namespace member, use the smx namespace itself as a function.

If the required parameter is a CSS selector string will return a collection of Nodes matching the given selector as a result of calling Document.find on the current active document.

If the paramater is single or array of XMLNode will return the input nodes wrapped as smx Nodes. Additionally if input are already smx Nodes will return already cached Nodes, so don't be afraid about rewraping nodes using this wrapper.

Parameters
Returns
Example
//use it as a namespace function.
smx('library > book');
// => [SMXNode, SMXNode, SMXNode, ...]

//not like this
smx.smx('library > book');
// => Error: smx.smx is not a Function.

load(url, onSuccess, onError)

  • async
  • static

Loads a new smx document.

Parameters

Type Definitions

onLoadSuccess(document)

Callback function when loading completes succefully.

Parameters
  • document {SMXDocument} :

    Just loaded document

onLoadError(error)

Callback function used loading throws an error.

Parameters
  • error {Error} :

    Error object