Skip to content

Commit

Permalink
Fixed script tags that were pointing to the wrong area. Also fixed is…
Browse files Browse the repository at this point in the history
…sue with IE not supporting navigator.language.
  • Loading branch information
Zoltan Hawryluk committed May 16, 2012
1 parent 77660a6 commit 2399264
Show file tree
Hide file tree
Showing 16 changed files with 60 additions and 110 deletions.
10 changes: 8 additions & 2 deletions shared/js/html5Forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ var html5Forms = new function () {

var globalEvent = document.addEventListener?document.createEvent("HTMLEvents"):null;


function getBrowserLanguage() {
var r = navigator.language;
if (!r) {
r = navigator.browserLanguage;
}
return r;
}

me.init = function () {
var scriptNodes = document.getElementsByTagName('script');
Expand Down Expand Up @@ -88,7 +94,7 @@ var html5Forms = new function () {
!lang.match(/^(af|al|bg|big5|br|ca|cn|cs|da|de|du|el|en|es|fi|fr|he|hr|hu|it|jp|ko|ko|lt|lt|lv|nl|no|pl|pl|pt|ro|ru|si|sk|sp|sv|tr|zh)$/)){


lang = navigator.language.split('-')[0];
lang = getBrowserLanguage().split('-')[0];
}


Expand Down
8 changes: 4 additions & 4 deletions tests/html5Forms/24ways.org/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
<link type="text/css" rel="stylesheet" href="../../../shared/css/useragentmanExample.css">

<!-- Needed for Forms Feature Detection -->
<script type="text/javascript" src="../../shared/js/modernizr.com/Modernizr-2.5.3.forms.js">
<script type="text/javascript" src="../../../shared/js/modernizr.com/Modernizr-2.5.3.forms.js">
</script>

<!-- Needed for Validation -->
<script type="text/javascript" src="../../shared/js/html5Forms.js" data-webforms2-support="validation,placeholder" data-webforms2-force-js-validation="true">
<script type="text/javascript" src="../../../shared/js/html5Forms.js" data-webforms2-support="validation,placeholder" data-webforms2-force-js-validation="true">
</script>


Expand Down Expand Up @@ -131,12 +131,12 @@ <h1>Payment form</h1>

<li>
<label for=cardnumber>Card number</label>
<input id=cardnumber name=cardnumber type=number required>
<input id=cardnumber name=cardnumber type=text required>
</li>

<li>
<label for=secure>Security code</label>
<input id=secure name=secure type=number required>
<input id=secure name=secure type=text required>
</li>

<li>
Expand Down
18 changes: 10 additions & 8 deletions tests/html5Forms/autofocus.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
<title>HTML5 autofocus Attribute Test</title>

<!-- Needed for Forms Feature Detection -->
<script type="text/javascript" src="../../html5Forms/shared/js/modernizr.com/Modernizr-2.5.3.forms.js">
<script type="text/javascript" src="../../shared/js/modernizr.com/Modernizr-2.5.3.forms.js">
</script>

<!-- Needed for Validation -->
<script type="text/javascript" src="../../html5Forms/shared/js/html5Forms.js" data-webforms2-support="autofocus" data-webforms2-force-js-validation="true">
<script type="text/javascript" src="../../shared/js/html5Forms.js" data-webforms2-support="autofocus" data-webforms2-force-js-validation="true">
</script>


Expand All @@ -30,7 +30,7 @@
</div>


<form action="/testForm.php">
<form action="http://www.useragentman.com/testForm.php">
<fieldset>
<legend>Personal Information</legend>

Expand Down Expand Up @@ -61,12 +61,14 @@
</tr>

<tr>
<th>Postal/Zip Code</th>
<td><input type="text" name="postalCode" value="" placeholder="Required information" required="required"
pattern="^([A-Za-z]\d[A-Za-z])\ {0,1}(\d[A-Za-z]\d)$"
<th>Zip Code</th>
<td><input type="text" name="postalCode" value="" required="required"
pattern="(\d{5}([\-]\d{4})?)" data-errormessage="This must be a valid postal code."
/>
<div class="description">Please enter a valid Canadian postal code. Valid format is <strong>H0H 0H0</strong> where <strong>H</strong>
is a letter and <strong>0</strong> is a number.</div>
<div class="description">Please enter a valid American postal code.
Valid format is <strong>nnnnn</strong> or <strong>nnnnn-nnnn</strong>
where <strong>n</strong>
is a numeric digit.</div>

</td>
</tr>
Expand Down
4 changes: 2 additions & 2 deletions tests/html5Forms/brucelawson.co.uk/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@
</style>

<!-- Needed for Forms Feature Detection -->
<script type="text/javascript" src="../../html5Forms/shared/js/modernizr.com/Modernizr-2.5.3.forms.js">
<script type="text/javascript" src="../../../shared/js/modernizr.com/Modernizr-2.5.3.forms.js">
</script>

<!-- Needed for Validation -->
<script type="text/javascript" src="../../html5Forms/shared/js/html5Forms.js" data-webforms2-support="all" >
<script type="text/javascript" src="../../../shared/js/html5Forms.js" data-webforms2-support="all" >
</script>


Expand Down
4 changes: 2 additions & 2 deletions tests/html5Forms/color.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@


<!-- Needed for Forms Feature Detection -->
<script type="text/javascript" src="../../html5Forms/shared/js/modernizr.com/Modernizr-2.5.3.forms.js">
<script type="text/javascript" src="../../shared/js/modernizr.com/Modernizr-2.5.3.forms.js">
</script>

<!-- Needed for Validation -->
<script type="text/javascript" src="../../html5Forms/shared/js/html5Forms.js" data-webforms2-support="color" data-webforms2-force-js-validation="true">
<script type="text/javascript" src="../../shared/js/html5Forms.js" data-webforms2-support="color" data-webforms2-force-js-validation="true">
</script>


Expand Down
4 changes: 2 additions & 2 deletions tests/html5Forms/dateTime.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@


<!-- Needed for Forms Feature Detection -->
<script type="text/javascript" src="../../html5Forms/shared/js/modernizr.com/Modernizr-2.5.3.forms.js">
<script type="text/javascript" src="../../shared/js/modernizr.com/Modernizr-2.5.3.forms.js">
</script>

<!-- Needed for Validation -->
<script type="text/javascript" src="../../html5Forms/shared/js/html5Forms.js" data-webforms2-support="date" data-webforms2-force-js-validation="true" data-lang="qq">
<script type="text/javascript" src="../../shared/js/html5Forms.js" data-webforms2-support="date" data-webforms2-force-js-validation="true" data-lang="qq">
</script>


Expand Down
58 changes: 0 additions & 58 deletions tests/html5Forms/dev.opera.com/index.html

This file was deleted.

4 changes: 2 additions & 2 deletions tests/html5Forms/example.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@


<!-- Needed for Forms Feature Detection -->
<script type="text/javascript" src="../../html5Forms/shared/js/modernizr.com/Modernizr-2.5.3.forms.js">
<script type="text/javascript" src="../../shared/js/modernizr.com/Modernizr-2.5.3.forms.js">
</script>

<!-- Needed for Validation -->
<script type="text/javascript" src="../../html5Forms/shared/js/html5Forms.js" data-webforms2-support="all" data-webforms2-force-js-validation="true">
<script type="text/javascript" src="../../shared/js/html5Forms.js" data-webforms2-support="all" data-webforms2-force-js-validation="true">
</script>

</head>
Expand Down
8 changes: 2 additions & 6 deletions tests/html5Forms/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,10 @@
<li>
<a href="bradshawenterprises.com/index.html">HTML5 Form Demo</a>
from <a href="http://www.bradshawenterprises.com/">Richard Bradshaw</a>'s
article <a href="http://www.bradshawenterprises.com/blog/2010/fancy-forms-html5-css3-js/">Fancy Forms: HTML5 + CSS3 – JS</a>
article <a href="http://www.bradshawenterprises.com/blog/2010/fancy-forms-html5-css3-js/">Fancy Forms: HTML5 + CSS3 – JS</a>.
It is a good example of how to use CSS3 to show the validity state of the form element.
</li>

<li>
<a href="dev.opera.com">Example</a> from the article
<a href="http://dev.opera.com/articles/view/improve-your-forms-using-html5/">Improve your forms using HTML5!</a>
from <a href="http://dev.opera.com">The Opera Developer Community Website</a>.
</li>
</ul>
</ul>
</fieldset>
Expand Down
4 changes: 2 additions & 2 deletions tests/html5Forms/miketaylr.com/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
</style>

<!-- Needed for Forms Feature Detection -->
<script type="text/javascript" src="../../html5Forms/shared/js/modernizr.com/Modernizr-2.5.3.forms.js">
<script type="text/javascript" src="../../shared/js/modernizr.com/Modernizr-2.5.3.forms.js">
</script>

<!-- Needed for Validation -->
<script type="text/javascript" src="../../html5Forms/shared/js/html5Forms.js" data-webforms2-support="all">
<script type="text/javascript" src="../../shared/js/html5Forms.js" data-webforms2-support="all">
</script>


Expand Down
4 changes: 2 additions & 2 deletions tests/html5Forms/output.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@


<!-- Needed for Forms Feature Detection -->
<script type="text/javascript" src="../../html5Forms/shared/js/modernizr.com/Modernizr-2.5.3.forms.js">
<script type="text/javascript" src="../../shared/js/modernizr.com/Modernizr-2.5.3.forms.js">
</script>

<!-- Needed for Validation -->
<script type="text/javascript" src="../../html5Forms/shared/js/html5Forms.js" data-webforms2-support="output" data-webforms2-force-js-validation="true">
<script type="text/javascript" src="../../shared/js/html5Forms.js" data-webforms2-support="output" data-webforms2-force-js-validation="true">
</script>

</head>
Expand Down
4 changes: 2 additions & 2 deletions tests/html5Forms/outputWithOnInput.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@


<!-- Needed for Forms Feature Detection -->
<script type="text/javascript" src="../../html5Forms/shared/js/modernizr.com/Modernizr-2.5.3.forms.js">
<script type="text/javascript" src="../../shared/js/modernizr.com/Modernizr-2.5.3.forms.js">
</script>

<!-- Needed for Validation -->
<script type="text/javascript" src="../../html5Forms/shared/js/html5Forms.js" data-webforms2-support="output" data-webforms2-force-js-validation="true">
<script type="text/javascript" src="../../shared/js/html5Forms.js" data-webforms2-support="output" data-webforms2-force-js-validation="true">
</script>

</head>
Expand Down
4 changes: 2 additions & 2 deletions tests/html5Forms/patternRequired.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@


<!-- Needed for Forms Feature Detection -->
<script type="text/javascript" src="../../html5Forms/shared/js/modernizr.com/Modernizr-2.5.3.forms.js">
<script type="text/javascript" src="../../shared/js/modernizr.com/Modernizr-2.5.3.forms.js">
</script>

<!-- Needed for Validation -->
<script type="text/javascript" src="../../html5Forms/shared/js/html5Forms.js" data-webforms2-support="validation">
<script type="text/javascript" src="../../shared/js/html5Forms.js" data-webforms2-support="validation">
</script>

</head>
Expand Down
4 changes: 2 additions & 2 deletions tests/html5Forms/patternRequiredWithVisibleIf.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
<script type="text/javascript" src="../../shared/js/visibleIf.js"></script>

<!-- Needed for Forms Feature Detection -->
<script type="text/javascript" src="../../html5Forms/shared/js/modernizr.com/Modernizr-2.5.3.forms.js">
<script type="text/javascript" src="../../shared/js/modernizr.com/Modernizr-2.5.3.forms.js">
</script>

<!-- Needed for Validation -->
<script type="text/javascript" src="../../html5Forms/shared/js/html5Forms.js" data-webforms2-support="validation" data-webforms2-force-js-validation="true">
<script type="text/javascript" src="../../shared/js/html5Forms.js" data-webforms2-support="validation" data-webforms2-force-js-validation="true">
</script>


Expand Down
16 changes: 9 additions & 7 deletions tests/html5Forms/placeholder.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@


<!-- Needed for Forms Feature Detection -->
<script type="text/javascript" src="../../html5Forms/shared/js/modernizr.com/Modernizr-2.5.3.forms.js">
<script type="text/javascript" src="../../shared/js/modernizr.com/Modernizr-2.5.3.forms.js">
</script>

<!-- Needed for Validation -->
<script type="text/javascript" src="../../html5Forms/shared/js/html5Forms.js" data-webforms2-support="validation, placeholder" data-webforms2-force-js-validation="true">
<script type="text/javascript" src="../../shared/js/html5Forms.js" data-webforms2-support="validation, placeholder" data-webforms2-force-js-validation="true">
</script>

</head>
Expand Down Expand Up @@ -64,12 +64,14 @@
</tr>

<tr>
<th>Postal/Zip Code</th>
<td><input type="text" name="postalCode" value="" placeholder="Required information" required="required"
pattern="^([A-Za-z]\d[A-Za-z])\ {0,1}(\d[A-Za-z]\d)$"
<th>Zip Code</th>
<td><input type="text" name="postalCode" value="" required="required"
pattern="(\d{5}([\-]\d{4})?)" data-errormessage="This must be a valid postal code."
/>
<div class="description">Please enter a valid Canadian postal code. Valid format is <strong>H0H 0H0</strong> where <strong>H</strong>
is a letter and <strong>0</strong> is a number.</div>
<div class="description">Please enter a valid American postal code.
Valid format is <strong>nnnnn</strong> or <strong>nnnnn-nnnn</strong>
where <strong>n</strong>
is a numeric digit.</div>

</td>
</tr>
Expand Down
16 changes: 9 additions & 7 deletions tests/html5Forms/range.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@


<!-- Needed for Forms Feature Detection -->
<script type="text/javascript" src="../../html5Forms/shared/js/modernizr.com/Modernizr-2.5.3.forms.js">
<script type="text/javascript" src="../../shared/js/modernizr.com/Modernizr-2.5.3.forms.js">
</script>

<!-- Needed for Validation -->
<script type="text/javascript" src="../../html5Forms/shared/js/html5Forms.js" data-webforms2-support="validation,range" data-webforms2-force-js-validation="true">
<script type="text/javascript" src="../../shared/js/html5Forms.js" data-webforms2-support="validation,range" data-webforms2-force-js-validation="true">
</script>

</head>
Expand Down Expand Up @@ -78,12 +78,14 @@
</tr>

<tr>
<th>Postal/Zip Code</th>
<td><input type="text" name="postalCode" value="" placeholder="Required information" required="required"
pattern="^([A-Za-z]\d[A-Za-z])\ {0,1}(\d[A-Za-z]\d)$"
<th>Zip Code</th>
<td><input type="text" name="postalCode" value="" required="required"
pattern="(\d{5}([\-]\d{4})?)" data-errormessage="This must be a valid postal code."
/>
<div class="description">Please enter a valid Canadian postal code. Valid format is <strong>H0H 0H0</strong> where <strong>H</strong>
is a letter and <strong>0</strong> is a number.</div>
<div class="description">Please enter a valid American postal code.
Valid format is <strong>nnnnn</strong> or <strong>nnnnn-nnnn</strong>
where <strong>n</strong>
is a numeric digit.</div>

</td>
</tr>
Expand Down

0 comments on commit 2399264

Please sign in to comment.