added getStyle, fixed setPosition
This commit is contained in:
parent
391e57c144
commit
ad46474275
@ -18,20 +18,21 @@
|
||||
<script type="text/javascript" src="../src/core/Util.js"></script>
|
||||
<script type="text/javascript" src="../src/core/Class.js"></script>
|
||||
<script type="text/javascript" src="../src/core/Events.js"></script>
|
||||
<script type="text/javascript" src="../src/core/Browser.js"></script>
|
||||
|
||||
<!-- /dom -->
|
||||
<script type="text/javascript" src="../src/dom/DomEvent.js"></script>
|
||||
<script type="text/javascript" src="../src/dom/DomUtil.js"></script>
|
||||
|
||||
<!-- /geo -->
|
||||
<script type="text/javascript" src="../src/geo/LatLng.js"></script>
|
||||
<script type="text/javascript" src="../src/geo/Projection.js"></script>
|
||||
|
||||
<!-- /geometry -->
|
||||
<script type="text/javascript" src="../src/geometry/Point.js"></script>
|
||||
<script type="text/javascript" src="../src/geometry/Bounds.js"></script>
|
||||
<script type="text/javascript" src="../src/geometry/Transformation.js"></script>
|
||||
|
||||
<!-- /geo -->
|
||||
<script type="text/javascript" src="../src/geo/LatLng.js"></script>
|
||||
<script type="text/javascript" src="../src/geo/Projection.js"></script>
|
||||
|
||||
<!-- /dom -->
|
||||
<script type="text/javascript" src="../src/dom/DomEvent.js"></script>
|
||||
<script type="text/javascript" src="../src/dom/DomUtil.js"></script>
|
||||
|
||||
<!-- spec files -->
|
||||
|
||||
<script type="text/javascript" src="suites/SpecHelper.js"></script>
|
||||
|
@ -24,4 +24,6 @@ describe('DomUtil', function() {
|
||||
});
|
||||
|
||||
describe('#setPosition', noSpecs);
|
||||
|
||||
describe('#getStyle', noSpecs);
|
||||
});
|
@ -6,7 +6,19 @@ L.DomUtil = {
|
||||
get: function(id) {
|
||||
return (typeof id == 'string' ? document.getElementById(id) : id);
|
||||
},
|
||||
|
||||
|
||||
getStyle: function(el, style) {
|
||||
var value = el.style[style];
|
||||
if ((typeof value == 'undefined') && el.currentStyle) {
|
||||
value = el.currentStyle[style];
|
||||
}
|
||||
if (typeof value == 'undefined') {
|
||||
var css = document.defaultView.getComputedStyle(el, null);
|
||||
value = css ? css[style] : null;
|
||||
}
|
||||
return (value == 'auto' ? null : value);
|
||||
},
|
||||
|
||||
getCumulativeOffset: function(el) {
|
||||
var top = 0,
|
||||
left = 0;
|
||||
@ -23,8 +35,8 @@ L.DomUtil = {
|
||||
if (L.Browser.webkit) {
|
||||
el.style.webkitTransform = 'translate(' + point.x + 'px,' + point.y + 'px)';
|
||||
} else {
|
||||
el.style.left = point.x;
|
||||
el.style.top = point.y;
|
||||
el.style.left = point.x + 'px';
|
||||
el.style.top = point.y + 'px';
|
||||
}
|
||||
},
|
||||
getPosition: function(el) {
|
||||
|
Loading…
Reference in New Issue
Block a user