Skip to content

Commit

Permalink
Merge branch 'main' into issue-OWASP-BLT#1556
Browse files Browse the repository at this point in the history
  • Loading branch information
DonnieBLT authored Nov 2, 2023
2 parents 495c1a6 + 06a3ed3 commit 72d46a0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
17 changes: 14 additions & 3 deletions website/static/js/jquery.caret.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
offset = this.getOldIEOffset();
}
if (offset) {
offset.top += $(oWindow).scrollTop();
if (oWindow && typeof oWindow === 'object' && 'scrollTo' in oWindow && 'document' in oWindow) {offset.top += $(oWindow).scrollTop();} else {console.error('oWindow is not a valid window object for scrolltop.');}
offset.left += $(oWindow).scrollLeft();
}
return offset;
Expand Down Expand Up @@ -216,8 +216,19 @@
$inputor = this.$inputor;
if (oDocument.selection) {
offset = this.getIEOffset(pos);
offset.top += $(oWindow).scrollTop() + $inputor.scrollTop();
offset.left += $(oWindow).scrollLeft() + $inputor.scrollLeft();
// Check if oWindow is a window object by checking for window-specific properties
function isValidWindow(obj) {
return obj && typeof obj === 'object' && 'scrollTo' in obj && obj.document && obj.self === obj;
}
// Then use this function in your conditionals
if (isValidWindow(oWindow)) {
offset.top += $(oWindow).scrollTop();
offset.left += $(oWindow).scrollLeft();
} else {
console.error('oWindow is not a valid window object.');
}
offset.top += $inputor.scrollTop();
offset.left += $inputor.scrollLeft();
return offset;
} else {
offset = $inputor.offset();
Expand Down
11 changes: 10 additions & 1 deletion website/static/vendor/jquery/jquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -5700,7 +5700,16 @@

jQuery.extend({
htmlPrefilter: function (html) {
var expandedHTML = html.replace(rxhtmlTag, "<$1></$2>");
var safeTagsToExpand = /<([a-z]+)([^<]*)\/>/gi;
var expandedHTML = html.replace(safeTagsToExpand, function(match, tag, attributes) {
// Check if the tag is one that should never be self-closing
if (!/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i.test(tag)) {
return "<" + tag + attributes + "></" + tag + ">";
} else {
// If it's a self-closing tag, leave it as is
return match;
}
});
return sanitizeHTML(expandedHTML);
},

Expand Down

0 comments on commit 72d46a0

Please sign in to comment.