mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-09-24 02:48:18 +00:00
Fix "TypeError: Cannot read property 'hasAttribute' of null" when loading on cached pages
Follow-up to c4de603ef9
.
Change-Id: I05dfb142e95e02715b56c2bd7c73bcfbb342fbfe
This commit is contained in:
parent
536f50c293
commit
f727c988a0
|
@ -85,7 +85,8 @@ ThreadItem.static.newFromJSON = function ( json, commentsById ) {
|
||||||
|
|
||||||
idEscaped = $.escapeSelector( item.id );
|
idEscaped = $.escapeSelector( item.id );
|
||||||
item.range = {
|
item.range = {
|
||||||
startContainer: document.getElementById( item.id ),
|
// Check old selector for compatibility with cached HTML
|
||||||
|
startContainer: document.getElementById( item.id ) || document.querySelector( '[data-mw-comment-start="' + idEscaped + '"]' ),
|
||||||
startOffset: 0,
|
startOffset: 0,
|
||||||
endContainer: document.querySelector( '[data-mw-comment-end="' + idEscaped + '"]' ),
|
endContainer: document.querySelector( '[data-mw-comment-end="' + idEscaped + '"]' ),
|
||||||
endOffset: 0
|
endOffset: 0
|
||||||
|
|
Loading…
Reference in a new issue