Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
Ire Aderinokun committed Dec 5, 2016
1 parent 38ceca6 commit c9f7084
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 19 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
bower_components
temp/
tools/
test.html
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ There are three properties you can add to the element for configuration -
Property | Description
---------|-------------
`feature` (required) | The feature slug, retrieved from caniuse.com
`futureVersions` | The number of future browser versions to display in the embed
`pastVersions` | The number of past browser versions to display in the embed
`futureVersions` | The number of future browser versions to display in the embed (max 3)
`pastVersions` | The number of past browser versions to display in the embed (max 5)


## Examples
Expand All @@ -43,7 +43,7 @@ Property | Description
```
-->
```html
<caniuse-embed feature="svg-html" futureVersions="1" pastVersions="2"></caniuse-embed>
<caniuse-embed feature="svg-html" future-versions="1" past-versions="2"></caniuse-embed>
```


Expand Down
20 changes: 4 additions & 16 deletions caniuse-embed.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
<link rel="import" href="../polymer/polymer.html">

<!--
## The (Unofficial) CanIUse Embed
`<caniuse-embed>` is a Polymer Element that displays feature support data from caniuse for multiple versions of the 10 major browsers. Configurable, reliable, and fully responsive. Based on this [original JavaScript embed](https://caniuse.bitsofco.de/).
For example, the following element will generate an embed for the feature, "SVG Effects for HTML"
<caniuse-embed feature="svg-html" futureVersions="1" pastVersions="2"></caniuse-embed>
<img src="https://github.com/ireade/caniuse-embed/raw/gh-pages/example.png" alt="" style="width: 100%">
-->

<dom-module id="caniuse-embed">

<template>
Expand Down Expand Up @@ -61,20 +48,21 @@

let future = '';
if ( futureVersions ) {
for (let i = 1; i < parseInt(futureVersions) + 1; i++) {
futureVersions = parseInt(futureVersions) > 3 ? 3 : parseInt(futureVersions);
for (let i = 1; i < futureVersions + 1; i++) {
future += `future_${i},`
}
}

let past = '';
if ( pastVersions ) {
for (let i = 1; i < parseInt(pastVersions) + 1; i++) {
pastVersions = parseInt(pastVersions) > 5 ? 5 : parseInt(pastVersions);
for (let i = 1; i < pastVersions + 1; i++) {
past += `,past_${i}`
}
}

return future + 'current' + past;

}


Expand Down

0 comments on commit c9f7084

Please sign in to comment.