Expand all

abstract ve.ce.View

Extends

Constructor

new ve.ce.View(model, [config])abstract #

Generic base class for CE views.

Parameters:

Name Type Attributes Description
model ve.dm.Model

Model to observe

config Object optional

Configuration options

Mixes in:
Source:
Generic base class for CE views.

Methods

destroy() #

Release all memory.

Source:
Release all memory.

getModel() → {ve.dm.Model} #

Get the model the view observes.

Source:

Returns:

Model the view observes

Type
ve.dm.Model
Get the model the view observes.

getModelHtmlDocument() → {HTMLDocument|null} #

Get an HTML document from the model, to use for URL resolution.

The default implementation returns null; subclasses should override this if they can provide a resolution document.

Source:
See:

Returns:

HTML document to use for resolution, or null if not available

Type
HTMLDocument | null
Get an HTML document from the model, to use for URL resolution.

getResolvedAttribute(key) → {string} #

Get a resolved URL from a model attribute.

Parameters:

Name Type Description
key string

Attribute name whose value is a URL

Source:

Returns:

URL resolved according to the document's base

Type
string
Get a resolved URL from a model attribute.

initialize() #

Initialize this.$element. This is called by the constructor and should be called every time this.$element is replaced.

Source:
Initialize this.$element.

isLive() → {boolean} #

Check if the view is attached to the live DOM.

Source:

Returns:

View is attached to the live DOM

Type
boolean
Check if the view is attached to the live DOM.

onSetup() #

Handle setup event.

Source:
Handle setup event.

onTeardown() #

Handle teardown event.

Source:
Handle teardown event.

setLive(live) #

Set live state.

Parameters:

Name Type Description
live boolean

The view has been attached to the live DOM (use false on detach)

Source:

Fires:

Set live state.

renderHtmlAttributes(attribute) → {boolean}static #

Allowed attributes for DOM elements, in the same format as ve.dm.Model#preserveHtmlAttributes

This list includes attributes that are generally safe to include in HTML loaded from a foreign source and displaying it inside the browser. It doesn't include any event attributes, for instance, which would allow arbitrary JavaScript execution. This alone is not enough to make HTML safe to display, but it helps.

TODO: Rather than use a single global list, set these on a per-view basis to something that makes sense for that view in particular.

Parameters:

Name Type Description
attribute string

Properties:

Type Description
boolean | function
Source:

Returns:

Attibute is allowed

Type
boolean

Allowed attributes for DOM elements, in the same format as ve.dm.Model#preserveHtmlAttributes

This list includes attributes that are generally safe to include in HTML loaded from a foreign source and displaying it inside the browser.

Events

setup() #

teardown() #