Skip to content

Commit

Permalink
Merge pull request #1055 from aparshin/layers-control-html
Browse files Browse the repository at this point in the history
Allow HTML in Layer Names (issue #1009)
  • Loading branch information
mourner committed Oct 15, 2012
2 parents 2482592 + cb44a6b commit 09060ff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 4 additions & 4 deletions dist/leaflet.css
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
.leaflet-control-zoom a {
background-color: rgba(255, 255, 255, 0.75);
}
.leaflet-control-zoom a, .leaflet-control-layers a {
.leaflet-control-zoom a, .leaflet-control-layers-toggle {
background-position: 50% 50%;
background-repeat: no-repeat;
display: block;
Expand Down Expand Up @@ -156,12 +156,12 @@
-webkit-border-radius: 8px;
border-radius: 8px;
}
.leaflet-control-layers a {
.leaflet-control-layers-toggle {
background-image: url(images/layers.png);
width: 36px;
height: 36px;
}
.leaflet-touch .leaflet-control-layers a {
.leaflet-touch .leaflet-control-layers-toggle {
width: 44px;
height: 44px;
}
Expand All @@ -179,7 +179,7 @@
color: #333;
background: #fff;
}
.leaflet-control-layers input {
.leaflet-control-layers-selector {
margin-top: 2px;
position: relative;
top: 1px;
Expand Down
6 changes: 4 additions & 2 deletions src/control/Control.Layers.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ L.Control.Layers = L.Control.extend({
// IE7 bugs out if you create a radio dynamically, so you have to do it this hacky way (see http://bit.ly/PqYLBe)
_createRadioElement: function (name, checked) {

var radioHtml = '<input type="radio" name="' + name + '"';
var radioHtml = '<input type="radio" class="leaflet-control-layers-selector" name="' + name + '"';
if (checked) {
radioHtml += ' checked="checked"';
}
Expand All @@ -155,6 +155,7 @@ L.Control.Layers = L.Control.extend({
if (obj.overlay) {
input = document.createElement('input');
input.type = 'checkbox';
input.className = 'leaflet-control-layers-selector';
input.defaultChecked = checked;
} else {
input = this._createRadioElement('leaflet-base-layers', checked);
Expand All @@ -164,7 +165,8 @@ L.Control.Layers = L.Control.extend({

L.DomEvent.on(input, 'click', this._onInputClick, this);

var name = document.createTextNode(' ' + obj.name);
var name = document.createElement('span');
name.innerHTML = ' ' + obj.name;

label.appendChild(input);
label.appendChild(name);
Expand Down

0 comments on commit 09060ff

Please sign in to comment.