mediawiki-extensions-Visual.../modules/ve/dm/annotations/ve.dm.LinkAnnotation.js
Timo Tijhof 8f05cdbf70 doc: Add placeholders for unindexed methods
Not having a description yet is fine, but they should at least
be indexed as blocks so that they are searchable and listed
in the jsduck generated pages. jsduck defaults to @method + name
of prototype property. And it even guesses parameters sometimes.

Search: \n\n([a-zA-Z\.]+\.prototype\.[a-zA-Z]+)
Where: modules/ve,modules/ve-mw
Where-Not: modules/ve/test
Replace: \n\n/** */\n$1

Added @return in a few places where it was easy to add.

Change-Id: I830c94cc7dbc261bd7a077391f930cbfff165f9d
2013-07-31 23:00:30 +00:00

65 lines
1.4 KiB
JavaScript

/*!
* VisualEditor DataModel LinkAnnotation class.
*
* @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
/**
* DataModel link annotation.
*
* Represents `<a>` tags that don't have a specific type.
*
* @class
* @extends ve.dm.Annotation
* @constructor
* @param {Object} element
*/
ve.dm.LinkAnnotation = function VeDmLinkAnnotation( element ) {
// Parent constructor
ve.dm.Annotation.call( this, element );
};
/* Inheritance */
ve.inheritClass( ve.dm.LinkAnnotation, ve.dm.Annotation );
/* Static Properties */
ve.dm.LinkAnnotation.static.name = 'link';
ve.dm.LinkAnnotation.static.matchTagNames = ['a'];
ve.dm.LinkAnnotation.static.splitOnWordbreak = true;
ve.dm.LinkAnnotation.static.toDataElement = function ( domElements ) {
return {
'type': 'link',
'attributes': {
'href': domElements[0].getAttribute( 'href' )
}
};
};
ve.dm.LinkAnnotation.static.toDomElements = function ( dataElement, doc ) {
var domElement = doc.createElement( 'a' );
domElement.setAttribute( 'href', dataElement.attributes.href );
return [ domElement ];
};
/* Methods */
/**
* @return {Object}
*/
ve.dm.LinkAnnotation.prototype.getComparableObject = function () {
return {
'type': this.getType(),
'href': this.getAttribute( 'href' )
};
};
/* Registration */
ve.dm.modelRegistry.register( ve.dm.LinkAnnotation );