X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/a6444c710cf37d7732aea76e752e43322b5036ca..9b5673a7aae863ab45c3b73460060352c5b3810b:/wp-admin/js/post.dev.js
diff --git a/wp-admin/js/post.dev.js b/wp-admin/js/post.dev.js
index fb9a00f0..9a39e08f 100644
--- a/wp-admin/js/post.dev.js
+++ b/wp-admin/js/post.dev.js
@@ -36,30 +36,39 @@ tagBox = {
},
quickClicks : function(el) {
- var thetags = $('.the-tags', el), tagchecklist = $('.tagchecklist', el), current_tags;
+ var thetags = $('.the-tags', el),
+ tagchecklist = $('.tagchecklist', el),
+ id = $(el).attr('id'),
+ current_tags, disabled;
if ( !thetags.length )
return;
- var disabled = thetags.attr('disabled');
+ disabled = thetags.attr('disabled');
current_tags = thetags.val().split(',');
tagchecklist.empty();
$.each( current_tags, function( key, val ) {
- var txt, button_id, id = $(el).attr('id');
+ var span, xbutton;
- val = $.trim(val);
- if ( !val.match(/^\s+$/) && '' != val ) {
- button_id = id + '-check-num-' + key;
- if ( disabled )
- txt = '' + val + ' ';
- else
- txt = 'X ' + val + ' ';
- tagchecklist.append(txt);
- if ( ! disabled )
- $( '#' + button_id ).click( function(){ tagBox.parseTags(this); });
+ val = $.trim( val );
+
+ if ( ! val )
+ return;
+
+ // Create a new span, and ensure the text is properly escaped.
+ span = $('').text( val );
+
+ // If tags editing isn't disabled, create the X button.
+ if ( ! disabled ) {
+ xbutton = $( 'X' );
+ xbutton.click( function(){ tagBox.parseTags(this); });
+ span.prepend(' ').prepend( xbutton );
}
+
+ // Append the span to the tag list.
+ tagchecklist.append( span );
});
},