Sys.Preview.MarkupContext

Used during the parsing of any XmlScript blocks on the page. It provides context when doing control lookups within templates.

Implements

  • Sys.IContainer

Properties

dataContext
Object; readOnly; provides context when declarative controls are created and databound; returns the dataContext passed into the constructor unless the dataContext has been hidden
isGlobal
Boolean; readOnly; returns true if the instance is global, otherwise false

Methods

constructor(document, global, parentContext, dataContext)
creates an instance of the class
  • document : the document object or a document fragment
  • global : Boolean; specifies whether the markupContext is considered global
  • parentContext : Sys.Preview.MarkupContext; optional; the parent context typically used when a child context is created when instantiating a template
  • dataContext : Object; optional; the data context typically used when a template is databound
addComponent(component, noRegisterWithApp)
adds a component to the markupContext and, by default, registers it with the Sys.Application singleton if this markupContext is global
  • component : Object
  • noRegisterWithApp : Boolean; optional; if true prevents the component from being registered with the Sys.Application singleton
removeComponent(component)1
removes the component and, if this markupContext is global, removes it from the Sys.Application singleton as well
  • component : Object; the component to remove
findComponent(id, parent)
finds the object with the id added to either this markupContext or the parent. If the object isn't found in this markupContext, the parentContext or the Sys.Application singleton is searched
  • id : String; the id of the component to find
  • parent : Object; optional; the parent scope at which to start searching
getComponents()
returns an Array that is a copy of the components added to this markupContext
addEndUpdate(instance)
adds an object with an endUpdate() method that will be called when the markupContext is closed
  • instance : Object; the object with an endUpdate() method that will be notified when the markupContext is closed
addReference(instance, propertyInfo, reference)
adds a deferred reference to another component that may not be available at this moment; it will be resolved when the markupContext is closed
  • instance : Object; the object to which a reference will be added
  • propertyInfo : Object; the propertyInfo from the TypeDescriptor that represents the property to which the reference will be assigned
  • reference : String; the id of the component that will be associated with the instance
close()
closes the markupContext; all deferred references are resolved; endUpdate() is called on any objects added with the addEndUpdate method
dispose()
disposes of the markupContext and all of the objects registered with it
findElement(id)
attempts to finds a DOM element with the id; search is limited to the scope of document passed into the constructor or the parentContext
  • id : String; the id of the DOM element to find
hideDataContext()
temporarily hides the dataContext until it is restored by calling restoreDataContext()
open()
prepares the markupContext for use; clears any pending references and objects pending a call to endUpdate()
restoreDataContext()
restores the dataContext if it was previously hidden

Static Methods

createGlobalContext()
shortcut for the constructor that creates a global context
createLocalContext(documentFragment, parentContext, dataContext)
shortcut for the constructor that creates a child context; typically used when instantiating a template
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License