Skip to content

Commit 7e8ee60

Browse files
committed
Temporary revert of "Change selectors for query examples"
This reverts commit c6b3b84. Temporarily revert this commit until MediaWiki has been update to REL1.43+ Bug: T399300
1 parent 2564f47 commit 7e8ee60

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

wikibase/queryService/api/QuerySamples.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,11 @@ wikibase.queryService.api.QuerySamples = ( function ( $ ) {
100100
* @private
101101
*/
102102
SELF.prototype._findPrevHeader = function ( element ) {
103-
var tag = element.children( ':first' ).prop( 'tagName' );
103+
var tag = element.prop( 'tagName' );
104104
if ( tag[0] !== 'H' && tag[0] !== 'h' ) {
105105
return null;
106106
}
107-
return this._findPrev( element, '.mw-heading' + ( tag.substr( 1 ) - 1 ) );
107+
return this._findPrev( element, 'h' + ( tag.substr( 1 ) - 1 ) );
108108
};
109109

110110
/**
@@ -153,12 +153,14 @@ wikibase.queryService.api.QuerySamples = ( function ( $ ) {
153153
$this.find( '.lineno' ).remove();
154154

155155
var query = $this.text().trim();
156+
156157
// Find preceding title element
157-
var titleEl = self._findPrev( $this, '.mw-heading2,.mw-heading3,.mw-heading4,.mw-heading5,.mw-heading6,.mw-heading7' );
158+
var titleEl = self._findPrev( $this, 'h2,h3,h4,h5,h6,h7' );
158159
if ( !titleEl || !titleEl.length ) {
159160
return null;
160161
}
161-
var title = titleEl.children( ':first' ).text().trim();
162+
var title = titleEl.text().trim();
163+
162164
return {
163165
title: title,
164166
query: query,

0 commit comments

Comments
 (0)