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:
Methods
destroy()
#
Release all memory.
- Source:
getModel() → {ve.dm.Model}
#
getModelHtmlDocument() → {HTMLDocument|null
}
#
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
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
initialize()
#
Initialize this.$element. This is called by the constructor and should be called every time this.$element is replaced.
- Source:
isLive() → {boolean}
#
Check if the view is attached to the live DOM.
- Source:
Returns:
View is attached to the live DOM
- Type
- boolean
onSetup()
#
Handle setup event.
- Source:
onTeardown()
#
Handle teardown event.
- Source:
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:
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()
#
- Source:
teardown()
#
- Source: