innerText → textContent

innerText is not supported in Firefox (and probably others).
textContent is supported everywhere since IE9.

Related to issue #133.
This commit is contained in:
Thaddee Tyl 2014-02-26 11:17:55 +01:00
parent 556f2aae0c
commit 7c2f55b225
2 changed files with 4 additions and 4 deletions

View File

@ -47,7 +47,7 @@ hr.spacing { border: 0; display: block; height: 3mm; }
<h2> Your Badge Service </h2>
<p>
<code>http://img.shields.io/badge/&lt;SUBJECT&gt;-&lt;STATUS&gt;-&lt;COLOR&gt;.svg</code>
<code><span id="imgUrlPrefix">http://img.shields.io/badge/</span>&lt;SUBJECT&gt;-&lt;STATUS&gt;-&lt;COLOR&gt;.svg</code>
</p><p>
Dashes <code>--</code><code>-</code> Dash <br/>
Underscores <code>__</code><code>_</code> Underscore <br/>
@ -170,7 +170,7 @@ And tell us, we might be able to bring it to you anyway!
<p>
<a href='https://github.com/h5bp/lazyweb-requests/issues/150'>This</a>.<br/>
All the activity and the code sits
<a href='https://github.com/badges/gh-badges'>here</a>.
<a href='https://github.com/badges/shields'>here</a>.
</p>
<h2> Contributors </h2>
@ -231,7 +231,7 @@ function escapeField(s) {
return s.replace(/-/g, '--').replace(/_/g, '__');
}
function makeImage() {
var url = '/badge/';
var url = document.getElementById('imgUrlPrefix').textContent;
url += escapeField(imageMaker.subject.value);
url += '-' + escapeField(imageMaker.status.value);
url += '-' + escapeField(imageMaker.color.value);

View File

@ -231,7 +231,7 @@ function escapeField(s) {
return s.replace(/-/g, '--').replace(/_/g, '__');
}
function makeImage() {
var url = document.getElementById('imgUrlPrefix').innerText;
var url = document.getElementById('imgUrlPrefix').textContent;
url += escapeField(imageMaker.subject.value);
url += '-' + escapeField(imageMaker.status.value);
url += '-' + escapeField(imageMaker.color.value);