r101739 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101738‎ | r101739 | r101740 >
Date:23:11, 2 November 2011
Author:tparscal
Status:deferred
Tags:
Comment:
Moving es.Html back to es/ directory
Modified paths:
  • /trunk/extensions/VisualEditor/modules/es/es.Html.js (added) (history)

Diff [purge]

Index: trunk/extensions/VisualEditor/modules/es/es.Html.js
@@ -0,0 +1,40 @@
 2+/**
 3+ * Static object with HTML generation helpers.
 4+ */
 5+es.Html = {
 6+ 'escapeText': function( text ) {
 7+ return text
 8+ .replace( /&/g, '&' )
 9+ .replace( /</g, '&lt;' )
 10+ .replace( />/g, '&gt;' )
 11+ .replace( /"/g, '&quot;' )
 12+ .replace( /'/g, '&#039;' );
 13+ },
 14+ 'makeAttributeList': function( attributes, prespace ) {
 15+ var attr = [];
 16+ var name;
 17+ if ( attributes ) {
 18+ for ( name in attributes ) {
 19+ attr.push( name + '="' + attributes[name] + '"' );
 20+ }
 21+ }
 22+ return ( prespace && attr.length ? ' ' : '' ) + attr.join( ' ' );
 23+ },
 24+ 'makeOpeningTag': function( name, attributes ) {
 25+ return '<' + name + es.Html.makeAttributeList( attributes, true ) + '>';
 26+ },
 27+ 'makeClosingTag': function( name ) {
 28+ return '</' + name + '>';
 29+ },
 30+ 'makeTag': function( name, attributes, value, escape ) {
 31+ if ( value === false ) {
 32+ return '<' + name + es.Html.makeAttributeList( attributes, true ) + ' />';
 33+ } else {
 34+ if ( escape ) {
 35+ value = wiki.util.xml.esc( value );
 36+ }
 37+ return '<' + name + es.Html.makeAttributeList( attributes, true ) + '>' +
 38+ value + '</' + name + '>';
 39+ }
 40+ }
 41+};

Status & tagging log