Update everything
This commit is contained in:
parent
bf368181a4
commit
72a485d6e8
319 changed files with 67958 additions and 13948 deletions
160
lib/angular/docs/partials/guide/ie.html
Normal file
160
lib/angular/docs/partials/guide/ie.html
Normal file
|
@ -0,0 +1,160 @@
|
|||
<h1><code ng:non-bindable=""></code>
|
||||
<span class="hint"></span>
|
||||
</h1>
|
||||
<div><h2>Overview</h2>
|
||||
|
||||
<p>This document describes the Internet Explorer (IE) idiosyncrasies when dealing with custom HTML
|
||||
attributes and tags. Read this document if you are planning on deploying your Angular application
|
||||
on IE v8.0 or earlier.</p>
|
||||
|
||||
<h2>Short Version</h2>
|
||||
|
||||
<p>To make your Angular application work on IE please make sure that:</p>
|
||||
|
||||
<ol>
|
||||
<li><p>You polyfill JSON.stringify if necessary (IE7 will need this). You can use
|
||||
<a href="https://github.com/douglascrockford/JSON-js">JSON2</a> or
|
||||
<a href="http://bestiejs.github.com/json3/">JSON3</a> polyfills for this.</p></li>
|
||||
<li><p>you <strong>do not</strong> use custom element tags such as <code><ng:view></code> (use the attribute version
|
||||
<code><div ng-view></code> instead), or</p></li>
|
||||
<li><p>if you <strong>do use</strong> custom element tags, then you must take these steps to make IE happy:</p></li>
|
||||
</ol>
|
||||
|
||||
<pre class="prettyprint linenums">
|
||||
<html xmlns:ng="http://angularjs.org">
|
||||
<head>
|
||||
<!--[if lte IE 8]>
|
||||
<script>
|
||||
document.createElement('ng-include');
|
||||
document.createElement('ng-pluralize');
|
||||
document.createElement('ng-view');
|
||||
|
||||
// Optionally these for CSS
|
||||
document.createElement('ng:include');
|
||||
document.createElement('ng:pluralize');
|
||||
document.createElement('ng:view');
|
||||
</script>
|
||||
<![endif]-->
|
||||
</head>
|
||||
<body>
|
||||
...
|
||||
</body>
|
||||
</html>
|
||||
</pre>
|
||||
|
||||
<p>The <strong>important</strong> parts are:</p>
|
||||
|
||||
<ul>
|
||||
<li><p><code>xmlns:ng</code> - <em>namespace</em> - you need one namespace for each custom tag you are planning on
|
||||
using.</p></li>
|
||||
<li><p><code>document.createElement(yourTagName)</code> - <em>creation of custom tag names</em> - Since this is an
|
||||
issue only for older version of IE you need to load it conditionally. For each tag which does
|
||||
not have namespace and which is not defined in HTML you need to pre-declare it to make IE
|
||||
happy.</p></li>
|
||||
</ul>
|
||||
|
||||
<h2>Long Version</h2>
|
||||
|
||||
<p>IE has issues with element tag names which are not standard HTML tag names. These fall into two
|
||||
categories, and each category has its own fix.</p>
|
||||
|
||||
<ul>
|
||||
<li><p>If the tag name starts with <code>my:</code> prefix than it is considered an XML namespace and must
|
||||
have corresponding namespace declaration on <code><html xmlns:my="ignored"></code></p></li>
|
||||
<li><p>If the tag has no <code>:</code> but it is not a standard HTML tag, then it must be pre-created using
|
||||
<code>document.createElement('my-tag')</code></p></li>
|
||||
<li><p>If you are planning on styling the custom tag with CSS selectors, then it must be
|
||||
pre-created using <code>document.createElement('my-tag')</code> regardless of XML namespace.</p></li>
|
||||
</ul>
|
||||
|
||||
<h3>The Good News</h3>
|
||||
|
||||
<p>The good news is that these restrictions only apply to element tag names, and not to element
|
||||
attribute names. So this requires no special handling in IE: <code><div my-tag your:tag>
|
||||
</div></code>.</p>
|
||||
|
||||
<h3>What happens if I fail to do this?</h3>
|
||||
|
||||
<p>Suppose you have HTML with unknown tag <code>mytag</code> (this could also be <code>my:tag</code> or <code>my-tag</code> with same
|
||||
result):</p>
|
||||
|
||||
<pre class="prettyprint linenums">
|
||||
<html>
|
||||
<body>
|
||||
<mytag>some text</mytag>
|
||||
</body>
|
||||
</html>
|
||||
</pre>
|
||||
|
||||
<p>It should parse into the following DOM:</p>
|
||||
|
||||
<pre class="prettyprint linenums">
|
||||
#document
|
||||
+- HTML
|
||||
+- BODY
|
||||
+- mytag
|
||||
+- #text: some text
|
||||
</pre>
|
||||
|
||||
<p>The expected behavior is that the <code>BODY</code> element has a child element <code>mytag</code>, which in turn has
|
||||
the text <code>some text</code>.</p>
|
||||
|
||||
<p>But this is not what IE does (if the above fixes are not included):</p>
|
||||
|
||||
<pre class="prettyprint linenums">
|
||||
#document
|
||||
+- HTML
|
||||
+- BODY
|
||||
+- mytag
|
||||
+- #text: some text
|
||||
+- /mytag
|
||||
</pre>
|
||||
|
||||
<p>In IE, the behavior is that the <code>BODY</code> element has three children:</p>
|
||||
|
||||
<ol>
|
||||
<li><p>A self closing <code>mytag</code>. Example of self closing tag is <code><br/></code>. The trailing <code>/</code> is optional,
|
||||
but the <code><br></code> tag is not allowed to have any children, and browsers consider <code><br>some
|
||||
text</br></code> as three siblings not a <code><br></code> with <code>some text</code> as child.</p></li>
|
||||
<li><p>A text node with <code>some text</code>. This should have been a child of <code>mytag</code> above, not a sibling.</p></li>
|
||||
<li><p>A corrupt self closing <code>/mytag</code>. This is corrupt since element names are not allowed to have
|
||||
the <code>/</code> character. Furthermore this closing element should not be part of the DOM since it is
|
||||
only used to delineate the structure of the DOM.</p></li>
|
||||
</ol>
|
||||
|
||||
<h3>CSS Styling of Custom Tag Names</h3>
|
||||
|
||||
<p>To make CSS selectors work with custom elements, the custom element name must be pre-created with
|
||||
<code>document.createElement('my-tag')</code> regardless of XML namespace.</p>
|
||||
|
||||
<pre class="prettyprint linenums">
|
||||
<html xmlns:ng="needed for ng: namespace">
|
||||
<head>
|
||||
<!--[if lte IE 8]>
|
||||
<script>
|
||||
// needed to make ng-include parse properly
|
||||
document.createElement('ng-include');
|
||||
|
||||
// needed to enable CSS reference
|
||||
document.createElement('ng:view');
|
||||
</script>
|
||||
<![endif]-->
|
||||
<style>
|
||||
ng\\:view {
|
||||
display: block;
|
||||
border: 1px solid red;
|
||||
}
|
||||
|
||||
ng-include {
|
||||
display: block;
|
||||
border: 1px solid blue;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<ng:view></ng:view>
|
||||
<ng-include></ng-include>
|
||||
...
|
||||
</body>
|
||||
</html>
|
||||
</pre></div>
|
Loading…
Add table
Add a link
Reference in a new issue