Skip to content

Commit 770eb67

Browse files
committed
Remove deprecated br clear
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/br The clear attribute is deprecated Use inline-block instead of float The zoom issue doesn't when using the gradient option
1 parent d489e2c commit 770eb67

File tree

3 files changed

+23
-19
lines changed

3 files changed

+23
-19
lines changed

inst/htmlwidgets/leaflet.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1815,7 +1815,7 @@ methods.addLegend = function (options) {
18151815
var leftDiv = (0, _jquery2.default)("<div/>").css("float", "left"),
18161816
rightDiv = (0, _jquery2.default)("<div/>").css("float", "left");
18171817
leftDiv.append(gradSpan);
1818-
(0, _jquery2.default)(div).append(leftDiv).append(rightDiv).append((0, _jquery2.default)("<br clear=\"both\"/>"));
1818+
(0, _jquery2.default)(div).append(leftDiv).append(rightDiv).append((0, _jquery2.default)("<br>"));
18191819

18201820
// Have to attach the div to the body at this early point, so that the
18211821
// svg text getComputedTextLength() actually works, below.
@@ -1863,7 +1863,7 @@ methods.addLegend = function (options) {
18631863
labels.push(options.na_label);
18641864
}
18651865
for (var i = 0; i < colors.length; i++) {
1866-
legendHTML += "<i style=\"background:" + colors[i] + ";opacity:" + options.opacity + "\"></i> " + labels[i] + "<br clear='both'/>";
1866+
legendHTML += "<i style=\"background:" + colors[i] + ";opacity:" + options.opacity + "\"></i> " + labels[i];
18671867
}
18681868
div.innerHTML = legendHTML;
18691869
}

inst/htmlwidgets/lib/leafletfix/leafletfix.css

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,31 @@ img.leaflet-tile {
66
border: none;
77
}
88
.info {
9-
padding: 6px 8px;
10-
font: 14px/16px Arial, Helvetica, sans-serif;
11-
background: white;
12-
background: rgba(255,255,255,0.8);
13-
box-shadow: 0 0 15px rgba(0,0,0,0.2);
14-
border-radius: 5px;
9+
padding: 6px 8px;
10+
font: 14px/16px Arial, Helvetica, sans-serif;
11+
background: white;
12+
background: rgba(255,255,255,0.8);
13+
box-shadow: 0 0 15px rgba(0,0,0,0.2);
14+
border-radius: 5px;
1515
}
1616
.legend {
17-
line-height: 18px;
18-
color: #555;
17+
line-height: 18px;
18+
color: #555;
1919
}
2020
.legend svg text {
21-
fill: #555;
21+
fill: #555;
2222
}
2323
.legend svg line {
24-
stroke: #555;
24+
stroke: #555;
2525
}
2626
.legend i {
27-
width: 18px;
28-
height: 18px;
29-
float: left;
30-
margin-right: 8px;
31-
opacity: 0.7;
27+
width: 18px;
28+
height: 18px;
29+
margin-right: 4px;
30+
opacity: 0.7;
31+
display: inline-block;
32+
vertical-align: top;
33+
/*For IE 7*/
34+
zoom: 1;
35+
*display: inline;
3236
}

javascript/src/methods.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ methods.addLegend = function(options) {
727727
rightDiv = $("<div/>").css("float", "left");
728728
leftDiv.append(gradSpan);
729729
$(div).append(leftDiv).append(rightDiv)
730-
.append($("<br clear=\"both\"/>"));
730+
.append($("<br>"));
731731

732732
// Have to attach the div to the body at this early point, so that the
733733
// svg text getComputedTextLength() actually works, below.
@@ -788,7 +788,7 @@ methods.addLegend = function(options) {
788788
}
789789
for (let i = 0; i < colors.length; i++) {
790790
legendHTML += "<i style=\"background:" + colors[i] + ";opacity:" +
791-
options.opacity + "\"></i> " + labels[i] + "<br clear='both'/>";
791+
options.opacity + "\"></i> " + labels[i];
792792
}
793793
div.innerHTML = legendHTML;
794794
}

0 commit comments

Comments
 (0)