Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

defer getting computed direction until it's needed #56

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions iron-iconset-svg.html
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@
// Remove old svg element
this.removeIcon(element);
// install new svg element
var svg = this._cloneIcon(iconName,
this.rtlMirroring && this._targetIsRTL(element));
var svg = this._cloneIcon(iconName, element);
if (svg) {
var pde = Polymer.dom(element);
pde.insertBefore(svg, pde.childNodes[0]);
Expand Down Expand Up @@ -180,27 +179,27 @@
* @return {Element} Returns an installable clone of the SVG element
* matching `id`.
*/
_cloneIcon: function(id, mirrorAllowed) {
_cloneIcon: function(id, target) {
// create the icon map on-demand, since the iconset itself has no discrete
// signal to know when it's children are fully parsed
this._icons = this._icons || this._createIconMap();
return this._prepareSvgClone(this._icons[id], this.size, mirrorAllowed);
return this._prepareSvgClone(this._icons[id], this.size, target);
},

/**
* @param {Element} sourceSvg
* @param {number} size
* @param {Boolean} mirrorAllowed
* @param {Element} target
* @return {Element}
*/
_prepareSvgClone: function(sourceSvg, size, mirrorAllowed) {
_prepareSvgClone: function(sourceSvg, size, target) {
if (sourceSvg) {
var content = sourceSvg.cloneNode(true),
svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'),
viewBox = content.getAttribute('viewBox') || '0 0 ' + size + ' ' + size,
cssText = 'pointer-events: none; display: block; width: 100%; height: 100%;';

if (mirrorAllowed && content.hasAttribute('mirror-in-rtl')) {
if (this.rtlMirroring && content.hasAttribute('mirror-in-rtl') && this._targetIsRTL(target)) {
cssText += '-webkit-transform:scale(-1,1);transform:scale(-1,1);';
}

Expand Down