Make WordPress Core

Changeset 32802


Ignore:
Timestamp:
06/16/2015 08:19:54 PM (11 years ago)
Author:
wonderboymusic
Message:

Add a class method to wpLink, buildHtml(). This will allows devs to duck-punch the implementation.

Props martinsachse.
Fixes #32180.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/js/wplink.js

    r32705 r32802  
    267267                },
    268268
     269                buildHtml: function(attrs) {
     270                        var html = '<a href="' + attrs.href + '"';
     271
     272                        if ( attrs.target ) {
     273                                html += ' target="' + attrs.target + '"';
     274                        }
     275
     276                        return html + '>';
     277                },
     278
    269279                update: function() {
    270280                        if ( wpLink.isMCE() ) {
     
    291301                        }
    292302
    293                         // Build HTML
    294                         html = '<a href="' + attrs.href + '"';
    295 
    296                         if ( attrs.target ) {
    297                                 html += ' target="' + attrs.target + '"';
    298                         }
    299 
    300                         html += '>';
     303                        html = wpLink.buildHtml(attrs);
    301304
    302305                        // Insert HTML
Note: See TracChangeset for help on using the changeset viewer.