diff --git a/modules/ext.categoryTree.js b/modules/ext.categoryTree.js index 7e5296c5..3278a508 100644 --- a/modules/ext.categoryTree.js +++ b/modules/ext.categoryTree.js @@ -163,6 +163,8 @@ uselang: mw.config.get( 'wgUserLanguage' ), formatversion: 2 } ).done( function ( data ) { + var $data; + data = data.categorytree.html; if ( data === '' ) { @@ -184,12 +186,13 @@ data = mw.msg( 'categorytree-nothing-found' ); } - data = $( '' ).text( data ); + $data = $( '' ).text( data ); + } else { + $data = $( $.parseHTML( data ) ); + attachHandler( $data ); } - $children.html( data ); - attachHandler( $children ); - + $children.empty().append( $data ); } ) .fail( error ); };