Skip to content

Commit e2f271d

Browse files
fix: DOM text reinterpreted as HTML (#1371)
1 parent 5321ce0 commit e2f271d

File tree

1 file changed

+13
-11
lines changed
  • src/main/resources/handlebars/swagger-static/assets/js

1 file changed

+13
-11
lines changed

src/main/resources/handlebars/swagger-static/assets/js/bootstrap.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
101101
}
102102

103-
$parent = $(selector)
103+
$parent = $(document).find(selector)
104104

105105
e && e.preventDefault()
106106

@@ -436,8 +436,9 @@
436436
* ================= */
437437

438438
$(document).on('click.carousel.data-api', '[data-slide]', function (e) {
439+
var selector = $(this).attr('data-target') || (href = $(this).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
439440
var $this = $(this), href
440-
, $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
441+
, $target = $(document).find(selector)
441442
, options = $.extend({}, $target.data(), $this.data())
442443
$target.carousel(options)
443444
e.preventDefault()
@@ -600,10 +601,9 @@
600601
* ================= */
601602

602603
$(document).on('click.collapse.data-api', '[data-toggle=collapse]', function (e) {
604+
var selector = $(this).attr('data-target') || e.preventDefault() || (href = $(this).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
603605
var $this = $(this), href
604-
, target = $this.attr('data-target')
605-
|| e.preventDefault()
606-
|| (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
606+
, target = $(document).find(selector)
607607
, option = $(target).data('collapse') ? 'toggle' : $this.data()
608608
$this[$(target).hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
609609
$(target).collapse(option)
@@ -726,7 +726,7 @@
726726
selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
727727
}
728728

729-
$parent = $(selector)
729+
$parent = $(document).find(selector)
730730
$parent.length || ($parent = $this.parent())
731731

732732
return $parent
@@ -999,9 +999,9 @@
999999
* ============== */
10001000

10011001
$(document).on('click.modal.data-api', '[data-toggle="modal"]', function (e) {
1002-
var $this = $(this)
1003-
, href = $this.attr('href')
1004-
, $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
1002+
var selector = $(this).attr('data-target') || (href = $(this).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
1003+
var $this = $(this), href
1004+
, $target = $(document).find(selector)
10051005
, option = $target.data('modal') ? 'toggle' : $.extend({ remote:!/#/.test(href) && href }, $target.data(), $this.data())
10061006

10071007
e.preventDefault()
@@ -1221,7 +1221,9 @@
12211221
, $e = this.$element
12221222
, o = this.options
12231223

1224-
title = $e.attr('data-original-title')
1224+
var target = $e.attr('data-original-title')
1225+
1226+
title = $(document).find(target)
12251227
|| (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
12261228

12271229
return title
@@ -1635,7 +1637,7 @@
16351637

16361638
if (e.isDefaultPrevented()) return
16371639

1638-
$target = $(selector)
1640+
$target = $(document).find(selector)
16391641

16401642
this.activate($this.parent('li'), $ul)
16411643
this.activate($target, $target.parent(), function () {

0 commit comments

Comments
 (0)