Update jQuery plugins
This commit is contained in:
@ -20,17 +20,10 @@ $.fn.isPresent = function() {
|
||||
|
||||
$.fn.scrollTo = function(selector) {
|
||||
$(this).animate({
|
||||
scrollTop: $(selector).offset().top - $(this).offset().top + $(this).scrollTop()
|
||||
scrollTop: $(document.querySelector(selector)).offset().top - $(this).offset().top + $(this).scrollTop()
|
||||
}, ANIMATION_DURATION);
|
||||
};
|
||||
|
||||
// Same as $.replaceWith, just returns the new element instead of the deleted one
|
||||
$.fn.replaceWithAndReturnNewElement = function(a) {
|
||||
const $a = $(a);
|
||||
this.replaceWith($a);
|
||||
return $a;
|
||||
};
|
||||
|
||||
// Disable the use of web workers for JStree due to JS error
|
||||
// See https://github.com/vakata/jstree/issues/1717 for details
|
||||
$.jstree.defaults.core.worker = false;
|
||||
|
@ -42,7 +42,9 @@ $(document).on('turbolinks:load', function() {
|
||||
if ($row.length === 0) {
|
||||
$row = $($('#posted_rfcs')[0].insertRow(0));
|
||||
}
|
||||
$row = $row.replaceWithAndReturnNewElement(data.html);
|
||||
const $html = $(data.html);
|
||||
$row.replaceWith($html);
|
||||
$row = $html;
|
||||
$row.find('time').timeago();
|
||||
addClickEventToRfCEntry($row);
|
||||
}
|
||||
|
Reference in New Issue
Block a user