Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
remove vertical-align, clean up code slightly
Browse files Browse the repository at this point in the history
  • Loading branch information
dfreedm committed Jun 12, 2014
1 parent b8d8dc5 commit c9d9812
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions core-iconset-svg.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@
/**
* @group Polymer Core Elements
*
* The `core-iconset-svg` element allows users to define their own icon sets
* The `core-iconset-svg` element allows users to define their own icon sets
* that contain svg icons. The svg icon elements should be children of the
* `core-iconset-svg` element. Multiple icons should be given distinct id's.
*
* Using svg elements to create icons has a few advantages over traditional
* Using svg elements to create icons has a few advantages over traditional
* bitmap graphics like jpg or png. Icons that use svg are vector based so they
* are resolution independent and should look good on any device. They are
* are resolution independent and should look good on any device. They are
* stylable via css. Icons can be themed, colorized, and even animated.
*
* Example:
*
* <core-iconset-svg id="my-svg-icons" iconSize="24">
* <svg>
* <svg>
* <defs>
* <g id="shape">
* <rect x="50" y="50" width="50" height="50" />
Expand All @@ -34,8 +34,8 @@
* </core-iconset-svg>
*
* This will automatically register the icon set "my-svg-icons" to the iconset
* database. To use these icons from within another element, make a
* `core-iconset` element and call the `byId` method
* database. To use these icons from within another element, make a
* `core-iconset` element and call the `byId` method
* to retrieve a given iconset. To apply a particular icon inside an
* element use the `applyIcon` method. For example:
*
Expand All @@ -50,11 +50,11 @@
<link rel="import" href="../core-iconset/core-iconset.html">

<polymer-element name="core-iconset-svg" extends="core-meta" attributes="iconSize">

<script>

Polymer('core-iconset-svg', {


/**
* The size of an individual icon. Note that icons must be square.
Expand All @@ -74,7 +74,7 @@
var icon = this.iconById(id);
if (icon) {
var content = icon.cloneNode(true);
var svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
svg.setAttribute('viewBox', '0 0 ' + this.iconSize + ' ' +
this.iconSize);
// NOTE(dfreedm): work around https://crbug.com/370136
Expand Down Expand Up @@ -120,11 +120,8 @@
return;
}
svg.style.height = svg.style.width = (scale * this.iconSize) + 'px';
svg.style.verticalAlign = 'middle';
svg.style.display = 'block'
if (svg) {
root.insertBefore(svg, root.firstElementChild);
}
root.insertBefore(svg, root.firstElementChild);
}
});

Expand Down

0 comments on commit c9d9812

Please sign in to comment.