Deprecate stringifyNumber, domContains, domMatchesSelector

This commit is contained in:
Leilei332
2025-08-31 17:33:09 +08:00
parent 24fd3918b5
commit 2263c74695
2 changed files with 6 additions and 15 deletions

View File

@@ -11,19 +11,11 @@ Various static DOM-related utility functions.
var Popup = require("$:/core/modules/utils/dom/popup.js");
/*
Determines whether element 'a' contains element 'b'
Code thanks to John Resig, http://ejohn.org/blog/comparing-document-position/
*/
exports.domContains = function(a,b) {
return a.contains ?
a !== b && a.contains(b) :
!!(a.compareDocumentPosition(b) & 16);
};
// Deprecated: Use compareDocumentPosition instead
exports.domContains = (a,b) => a.compareDocumentPosition(b) & 16;
exports.domMatchesSelector = function(node,selector) {
return node.matches ? node.matches(selector) : node.msMatchesSelector(selector);
};
// Deprecated: Use matches instead
exports.domMatchesSelector = (node,selector) => node.matches(selector);
/*
Select text in a an input or textarea (setSelectionRange crashes on certain input types)

View File

@@ -936,9 +936,8 @@ exports.parseInt = function(str) {
return parseInt(str,10) || 0;
};
exports.stringifyNumber = function(num) {
return num + "";
};
// Use Number.toString instead
exports.stringifyNumber = num => num.toString();
exports.makeCompareFunction = function(type,options) {
options = options || {};