<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<title><![CDATA[X-Intend[超级打算]]]></title>
<link>http://www.xintend.com</link>
<description><![CDATA[每个人都有自己的想法,哪怕仅仅一瞬间~！]]></description>
<pubDate>2010-03-13 06:41:34Z</pubDate>
<item>
<title><![CDATA[每日一Tip_强制WEB App在iPhone中全屏模式运行]]></title>
<link>http://www.xintend.com/Article/PhXJtJIypMhstMClodkh.aspx</link>
<category><![CDATA[心得]]></category>
<author>KingFo</author>
<pubDate>2010-03-11 09:38:12Z</pubDate>
<description><![CDATA[<p>&nbsp;</p>
<pre><ol class="dp-xml"><li class="alt"><span><span class="tag">&lt;</span><span class="tag-name">meta</span><span>&nbsp;</span><span class="attribute">name</span><span>=</span><span class="attribute-value">&quot;viewport&quot;</span><span>&nbsp;</span><span class="attribute">content</span><span>=</span><span class="attribute-value">&quot;width=device-width;&nbsp;initial-&nbsp;scale=1.0;&nbsp;maximum-scale=1.0;&nbsp;user-scalable=0;&quot;</span><span>&nbsp;</span><span class="tag">/&gt;</span><span>&nbsp;</span></span></li><li><span><span class="tag">&lt;</span><span class="tag-name">meta</span><span>&nbsp;</span><span class="attribute">name</span><span>=</span><span class="attribute-value">&quot;apple-mobile-web-app-capable&quot;</span><span>&nbsp;</span><span class="attribute">content</span><span>=</span><span class="attribute-value">&quot;yes&quot;</span><span>&nbsp;</span><span class="tag">/&gt;</span><span>&nbsp;</span></span></li><li class="alt"><span><span class="tag">&lt;</span><span class="tag-name">meta</span><span>&nbsp;</span><span class="attribute">names</span><span>=</span><span class="attribute-value">&quot;apple-mobile-web-app-status-bar-style&quot;</span><span>&nbsp;</span><span class="attribute">content</span><span>=</span><span class="attribute-value">&quot;black-translucent&quot;</span><span>&nbsp;</span><span class="tag">/&gt;</span><span>&nbsp;&nbsp;</span></span></li></ol></pre>
<p>-----来自团队的总结</p></p>]]></description>
</item>
<item>
<title><![CDATA[HTML5处理音频说明]]></title>
<link>http://www.xintend.com/Article/hXjBVoUGxwKeRrnwKeoA.aspx</link>
<category><![CDATA[开发者]]></category>
<author>KingFo</author>
<pubDate>2010-03-10 14:04:29Z</pubDate>
<description><![CDATA[<p>&nbsp;</p>
<script type="text/javascript" src="http://assets.taobaocdn.com/app/tms/tms-edit-link.js"></script>
<script type="text/javascript" src="http://assets.taobaocdn.com/app/tms/tms-edit-link.js"></script>
<p>https://wiki.mozilla.org/Audio_Data_API</p>]]></description>
</item>
<item>
<title><![CDATA[[转]Custom events in JavaScript]]></title>
<link>http://www.xintend.com/Article/pwlKZqSiiiTtWtYsAHVV.aspx</link>
<category><![CDATA[开发者]]></category>
<author>KingFo</author>
<pubDate>2010-03-10 13:01:41Z</pubDate>
<description><![CDATA[<p>&nbsp;</p>
<!--{12681974632840}-->
<div class="post-head">
<h1>Custom events in JavaScript</h1>
<p class="byline">Posted at March 9, 2010 09:00 am by Nicholas C. Zakas</p>
<p class="tags">Tags: <a rel="tag" href="http://www.nczonline.net/blog/tag/bom/">BOM</a>, <a rel="tag" href="http://www.nczonline.net/blog/tag/dom/">DOM</a>, <a rel="tag" href="http://www.nczonline.net/blog/tag/events/">Events</a>, <a rel="tag" href="http://www.nczonline.net/blog/tag/javascript/">JavaScript</a></p>
<p class="tags">&nbsp;</p>
<p>Without a doubt, the most often-used paradigm in JavaScript is events. Events are a manifestation of the <a href="http://en.wikipedia.org/wiki/Observer_pattern">observer pattern</a>, a well-defined computer science design pattern for loose coupling. <a href="http://en.wikipedia.org/wiki/Loose_coupling">Loose coupling</a> is incredibly important for creating maintainable, stable codebases. I talk a lot about loose coupling and its importance in my talk, <a href="http://www.slideshare.net/nzakas/scalable-javascript-application-architecture">Scalable JavaScript Application Architecture</a> (<a href="http://developer.yahoo.com/yui/theater/video.php?v=zakas-architecture">video</a>), so I won&rsquo;t talk too much about it here. However, the concept is very important to grasp if you wish to progress as a software engineer.</p>
<h2>Events</h2>
<p>Unless you&rsquo;ve never written any JavaScript before, you&rsquo;ve used events at some point in time (admittedly, if you&rsquo;ve never written JavaScript before, the chances of your reading my blog are probably pretty slim). Put quite simply: the way that you tie behavior to web pages is through events. Events are a way of letting interested parties know that an important moment has occurred in the lifecycle of the application. For instance:</p>
<pre><ol class="dp-c"><li class="alt"><span><span>window.onload&nbsp;=&nbsp;</span><span class="keyword">function</span><span>(){&nbsp;</span></span></li><li><span>&nbsp;&nbsp;&nbsp;&nbsp;Application.init();&nbsp;</span></li><li class="alt"><span>};&nbsp;</span></li></ol></pre>
<pre><code><br /></code></pre>
<p>In this example, the <code>load</code> event is the interesting moment. I want to know when the window is fully loaded so that I can initialized the JavaScript application. The <code>onload</code> event handler is the location to where an event handler is assigned. The brilliant part is that <code>window</code> doesn&rsquo;t care what web page is loaded or who is writing the code; it just knows that there&rsquo;s a function to call when <code>load</code> occurs. This is the essence of loose coupling: when parts of an application have very limited knowledge of one another.</p>
<p>The <a href="http://javascript.about.com/od/browserobjectmodel/a/bom01.htm">Browser Object Model</a> (BOM) and <a href="http://www.w3.org/DOM/">Document Object Model</a> (DOM) publish events to allow developers access to the interesting moments of the browser and web page, respectively.</p>
<h2>Custom events</h2>
<p>It&rsquo;s no surprise that most JavaScript libraries rely heavily on custom events since this is a pattern that web developers are familiar with. Every major JavaScript library provides its own events, components to enable easy custom event definition, or both. This makes sense, of course, since libraries want to be loosely-coupled to the execution environment, and therefore, to your code.</p>
<p>There&rsquo;s nothing magic about custom events, though, and there&rsquo;s no need to load an entire library if you&rsquo;d like to experiment with custom events. An object that supports custom events needs to be able to do a small set of things:</p>
<ol>
    <li>Assign an event handler for a particular event.</li>
    <li>Remove an event handler for a particular event.</li>
    <li>Fire an event and call all assigned event handlers.</li>
</ol>
<p>The following implements all of this basic functionality:</p>
<pre><ol class="dp-c"><li class="alt"><span><span class="comment">//Copyright&nbsp;(c)&nbsp;2010&nbsp;Nicholas&nbsp;C.&nbsp;Zakas.&nbsp;All&nbsp;rights&nbsp;reserved.</span><span>&nbsp;</span></span></li><li><span><span class="comment">//MIT&nbsp;License</span><span>&nbsp;</span></span></li><li class="alt"><span>&nbsp;</span></li><li><span><span class="keyword">function</span><span>&nbsp;EventTarget(){&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">this</span><span>._listeners&nbsp;=&nbsp;{};&nbsp;</span></span></li><li><span>}&nbsp;</span></li><li class="alt"><span>&nbsp;</span></li><li><span>EventTarget.prototype&nbsp;=&nbsp;{&nbsp;</span></li><li class="alt"><span>&nbsp;</span></li><li><span>&nbsp;&nbsp;&nbsp;&nbsp;constructor:&nbsp;EventTarget,&nbsp;</span></li><li class="alt"><span>&nbsp;</span></li><li><span>&nbsp;&nbsp;&nbsp;&nbsp;addListener:&nbsp;<span class="keyword">function</span><span>(type,&nbsp;listener){&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">if</span><span>&nbsp;(</span><span class="keyword">typeof</span><span>&nbsp;</span><span class="keyword">this</span><span>._listeners[type]&nbsp;==&nbsp;</span><span class="string">&quot;undefined&quot;</span><span>){&nbsp;</span></span></li><li><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">this</span><span>._listeners[type]&nbsp;=&nbsp;[];&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;</span></li><li><span>&nbsp;</span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">this</span><span>._listeners[type].push(listener);&nbsp;</span></span></li><li><span>&nbsp;&nbsp;&nbsp;&nbsp;},&nbsp;</span></li><li class="alt"><span>&nbsp;</span></li><li><span>&nbsp;&nbsp;&nbsp;&nbsp;fire:&nbsp;<span class="keyword">function</span><span>(event){&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">if</span><span>&nbsp;(</span><span class="keyword">typeof</span><span>&nbsp;event&nbsp;==&nbsp;</span><span class="string">&quot;string&quot;</span><span>){&nbsp;</span></span></li><li><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;event&nbsp;=&nbsp;{&nbsp;type:&nbsp;event&nbsp;};&nbsp;</span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;</span></li><li><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">if</span><span>&nbsp;(!event.target){&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;event.target&nbsp;=&nbsp;<span class="keyword">this</span><span>;&nbsp;</span></span></li><li><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;</span></li><li class="alt"><span>&nbsp;</span></li><li><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">if</span><span>&nbsp;(!event.type){&nbsp;&nbsp;</span><span class="comment">//falsy</span><span>&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">throw</span><span>&nbsp;</span><span class="keyword">new</span><span>&nbsp;Error(</span><span class="string">&quot;Event&nbsp;object&nbsp;missing&nbsp;&#39;type&#39;&nbsp;property.&quot;</span><span>);&nbsp;</span></span></li><li><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;</span></li><li class="alt"><span>&nbsp;</span></li><li><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">if</span><span>&nbsp;(</span><span class="keyword">this</span><span>._listeners[event.type]&nbsp;</span><span class="keyword">instanceof</span><span>&nbsp;Array){&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">var</span><span>&nbsp;listeners&nbsp;=&nbsp;</span><span class="keyword">this</span><span>._listeners[event.type];&nbsp;</span></span></li><li><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">for</span><span>&nbsp;(</span><span class="keyword">var</span><span>&nbsp;i=0,&nbsp;len=listeners.length;&nbsp;i&nbsp;&lt;&nbsp;len;&nbsp;i++){&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;listeners[i].call(<span class="keyword">this</span><span>,&nbsp;event);&nbsp;</span></span></li><li><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;</span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;</span></li><li><span>&nbsp;&nbsp;&nbsp;&nbsp;},&nbsp;</span></li><li class="alt"><span>&nbsp;</span></li><li><span>&nbsp;&nbsp;&nbsp;&nbsp;removeListener:&nbsp;<span class="keyword">function</span><span>(type,&nbsp;listener){&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">if</span><span>&nbsp;(</span><span class="keyword">this</span><span>._listeners[type]&nbsp;</span><span class="keyword">instanceof</span><span>&nbsp;Array){&nbsp;</span></span></li><li><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">var</span><span>&nbsp;listeners&nbsp;=&nbsp;</span><span class="keyword">this</span><span>._listeners[type];&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">for</span><span>&nbsp;(</span><span class="keyword">var</span><span>&nbsp;i=0,&nbsp;len=listeners.length;&nbsp;i&nbsp;&lt;&nbsp;len;&nbsp;i++){&nbsp;</span></span></li><li><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">if</span><span>&nbsp;(listeners[i]&nbsp;===&nbsp;listener){&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;listeners.splice(i,&nbsp;1);&nbsp;</span></li><li><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">break</span><span>;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;</span></li><li><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;</span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;</span></li><li><span>&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;</span></li><li class="alt"><span>};&nbsp;</span></li></ol></pre>
<pre><code><br /></code></pre>
<p>The <code>EventTarget</code> type has three methods: <code>addListener()</code>, <code>fire()</code>, and <code>removeListener</code>.</p>
<p>The <code>addListener()</code> uses the private <code>_listeners</code> object to store event handlers for various events. When an event handler is added, the method first checks to see if there&rsquo;s a named property for that event type on the <code>_listeners</code> object, and if not, creates one containing an array. The event handler function is then saved to the array for later.</p>
<p>The <code>fire()</code> method fires an event with a given name. In effect, this method&rsquo;s only job is to execute each event handler for the given event type. The method accepts either an object, in which case it&rsquo;s expected to have a <code>type</code> property, or a string, in which case a new object is created and the string is assigned as the value of <code>type</code>. Next, if the event object doesn&rsquo;t have a <code>target</code> property assigned, it is set to the current instance. This effectively creates an event object similar to the one most are familiar with via the BOM and DOM. Once the event object is created, the <code>_listeners</code> object is checked for event handlers, and if found, they are executed. Note that in order to mimic the BOM/DOM approach, event handlers are executed in the scope of <code>this</code> via the <code>call()</code> method.</p>
<p>The last method, <code>removeListener()</code>, simply reverses the process of <code>addListener()</code>. It searches through the <code>_listeners</code> property for the given event type to locate the specified event handler. If found, the event handler is removed by using the array&rsquo;s <code>splice()</code> method, and otherwise it exits without doing anything.</p>
<p>Basic usage:</p>
<pre><ol class="dp-c"><li class="alt"><span><span class="keyword">var</span><span>&nbsp;target&nbsp;=&nbsp;</span><span class="keyword">new</span><span>&nbsp;EventTarget();&nbsp;</span></span></li><li><span><span class="keyword">function</span><span>&nbsp;handleEvent(event){&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;alert(event.type);&nbsp;</span></li><li><span>};&nbsp;</span></li><li class="alt"><span>&nbsp;</span></li><li><span>target.addListener(<span class="string">&quot;foo&quot;</span><span>,&nbsp;handleEvent);&nbsp;</span></span></li><li class="alt"><span>target.fire({&nbsp;type:&nbsp;<span class="string">&quot;foo&quot;</span><span>&nbsp;});&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="comment">//can&nbsp;also&nbsp;do&nbsp;target.fire(&quot;foo&quot;)</span><span>&nbsp;</span></span></li><li><span>target.removeListener(<span class="string">&quot;foo&quot;</span><span>,&nbsp;handleEvent);&nbsp;</span></span></li></ol></pre>
<pre><code><br /></code></pre>
<p>Practically speaking, you&rsquo;ll likely not want to use an instance of <code>EventTarget</code> directly, but rather inherit from it:</p>
<pre><ol class="dp-c"><li class="alt"><span><span class="keyword">function</span><span>&nbsp;MyObject(){&nbsp;</span></span></li><li><span>&nbsp;&nbsp;&nbsp;&nbsp;EventTarget.call(<span class="keyword">this</span><span>);&nbsp;</span></span></li><li class="alt"><span>}&nbsp;</span></li><li><span>&nbsp;</span></li><li class="alt"><span>MyObject.prototype&nbsp;=&nbsp;<span class="keyword">new</span><span>&nbsp;EventTarget();&nbsp;</span></span></li><li><span>MyObject.prototype.constructor&nbsp;=&nbsp;MyObject;&nbsp;</span></li><li class="alt"><span>MyObject.prototype.foo&nbsp;=&nbsp;<span class="keyword">function</span><span>(){&nbsp;</span></span></li><li><span>&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">this</span><span>.fire(</span><span class="string">&quot;foo&quot;</span><span>);&nbsp;</span></span></li><li class="alt"><span>};&nbsp;</span></li><li><span>&nbsp;</span></li><li class="alt"><span><span class="keyword">var</span><span>&nbsp;o&nbsp;=&nbsp;</span><span class="keyword">new</span><span>&nbsp;MyObject();&nbsp;</span></span></li><li><span>&nbsp;</span></li><li class="alt"><span>o.addListener(<span class="string">&quot;foo&quot;</span><span>,&nbsp;</span><span class="keyword">function</span><span>(){&nbsp;</span></span></li><li><span>&nbsp;&nbsp;&nbsp;&nbsp;alert(<span class="string">&quot;Foo&nbsp;just&nbsp;happened.&quot;</span><span>);&nbsp;</span></span></li><li class="alt"><span>});&nbsp;</span></li><li><span>&nbsp;</span></li><li class="alt"><span>o.foo();&nbsp;</span></li></ol></pre>
<pre><code><br /></code></pre>
<p>Typically, events are fired in reaction to some other method call, as in this example (events are usually not fired external to the object that is publishing the events).</p>
<h2>What about&hellip;?</h2>
<p>This is a pretty barebones implementation of a custom event providing object, so inevitably someone will come along and ask why I didn&rsquo;t include one feature or another. There are, of course, a lot of enhancements you can make to custom events if you so desire. Some enhancements others have implemented:</p>
<ul>
    <li>Bubbling of events</li>
    <li>Continue to execute event handlers even if one throws an error</li>
    <li>Allow event handlers to cancel further processing or default actions</li>
</ul>
<p>Each of these can be built pretty easily on top of the base presented in this post.</p>
<h2>Conclusion</h2>
<p>Custom events are a very powerful and useful pattern in JavaScript programming, and your usage of them doesn&rsquo;t have to rely on a large JavaScript library. Implementing your own custom events is easy. The implementation presented in this post is a minimum feature set that typically fulfills most requirements, but you can consider it as a starting point for more advanced functionality if your requirements are more complex.</p>
</div>
<!--{12681974632841}-->
<script type="text/javascript" src="http://assets.taobaocdn.com/app/tms/tms-edit-link.js"></script>
<p>&nbsp;</p></p></p></p></p></p></p></p></p></h></h></h></h></h>]]></description>
</item>
<item>
<title><![CDATA[每日一Tip_文件命名]]></title>
<link>http://www.xintend.com/Article/rEhsZdblmfdXkxOzMYbP.aspx</link>
<category><![CDATA[心得]]></category>
<author>KingFo</author>
<pubDate>2010-03-10 10:01:46Z</pubDate>
<description><![CDATA[<p>&nbsp;</p>
<script type="text/javascript" src="http://assets.taobaocdn.com/app/tms/tms-edit-link.js"></script> <blockquote>
<p>文件全部都是用小写和下划线，样式命名全部使用小写和连接符，JS的钩子使用&ldquo;J_HiTao&rdquo;</p>
</blockquote>
<p>----来自团队的总结</p>
<script type="text/javascript" src="http://assets.taobaocdn.com/app/tms/tms-edit-link.js"></script>]]></description>
</item>
<item>
<title><![CDATA[每日一Tip_HTML自定义属性]]></title>
<link>http://www.xintend.com/Article/TkeBcOqxPSUaAcumnXnf.aspx</link>
<category><![CDATA[心得]]></category>
<author>KingFo</author>
<pubDate>2010-03-10 10:00:45Z</pubDate>
<description><![CDATA[<p>&nbsp;</p>
<script type="text/javascript" src="http://assets.taobaocdn.com/app/tms/tms-edit-link.js"></script>
<blockquote>
<p><font face="宋体" color="#000000" style="font-size: 10pt;">需要为html元素添加自定义属性的时候，首先要考虑下有没有默认的已有的合适标签去设置，如果没有，可以使用以&quot;data-&quot;为前缀来添加自定义属性，避免使用&quot;data:&quot;</font></p>
</blockquote>
<p>----来自团队的总结</p>]]></description>
</item>
<item>
<title><![CDATA[每日一Tip_assets文件约定]]></title>
<link>http://www.xintend.com/Article/txmXMYdKgrWmQRAcmalX.aspx</link>
<category><![CDATA[心得]]></category>
<author>KingFo</author>
<pubDate>2010-03-10 09:59:29Z</pubDate>
<description><![CDATA[<p>&nbsp;</p>
<script type="text/javascript" src="http://assets.taobaocdn.com/app/tms/tms-edit-link.js"></script>
<blockquote>
<p><font face="宋体" color="#000000" style="font-size: 10pt;">TaobaoUED前端的assets文件要求编码必须为GBK、GB2312或者GB18030，我们的demo尽量也都为gbk编码~</font></p>
</blockquote>
<p>----来自团队的总结</p>]]></description>
</item>
<item>
<title><![CDATA[每日一Tip_HTML代码约定]]></title>
<link>http://www.xintend.com/Article/UtGwPRjaJmBTylVHXDYV.aspx</link>
<category><![CDATA[心得]]></category>
<author>KingFo</author>
<pubDate>2010-03-10 09:57:21Z</pubDate>
<description><![CDATA[<p>&nbsp;</p>
<script type="text/javascript" src="http://assets.taobaocdn.com/app/tms/tms-edit-link.js"></script> <blockquote>
<p>html代码要求所有的标签、属性都是用小写字母，属性值使用双引号括起来，使用js插入html代码的时候也要注意保持一致。</p>
</blockquote>
<p>----来自团队的总结</p>
<script type="text/javascript" src="http://assets.taobaocdn.com/app/tms/tms-edit-link.js"></script>]]></description>
</item>
<item>
<title><![CDATA[每日一Tip_JS命名约定]]></title>
<link>http://www.xintend.com/Article/vWnKxKKVdpLnDEzPfxcp.aspx</link>
<category><![CDATA[心得]]></category>
<author>KingFo</author>
<pubDate>2010-03-10 09:55:14Z</pubDate>
<description><![CDATA[<p>&nbsp;</p>
<script type="text/javascript" src="http://assets.taobaocdn.com/app/tms/tms-edit-link.js"></script> <blockquote>
<p>JS代码中，应该尽量在函数开始地方统一进行变量声明，变量名注意语义化，一般使用名词来命名，不要在意名字的长度，压缩后会替换为简短的变量名的。</p>
</blockquote>
<p>----来自团队的总结</p>
<script type="text/javascript" src="http://assets.taobaocdn.com/app/tms/tms-edit-link.js"></script>]]></description>
</item>
<item>
<title><![CDATA[每日一Tip_JS浮点数计算]]></title>
<link>http://www.xintend.com/Article/AxISzZbMAmqZXnmUnHxO.aspx</link>
<category><![CDATA[心得]]></category>
<author>KingFo</author>
<pubDate>2010-03-10 09:54:08Z</pubDate>
<description><![CDATA[<p>&nbsp;</p>
<script type="text/javascript" src="http://assets.taobaocdn.com/app/tms/tms-edit-link.js"></script> <blockquote>
<p>JS中，浮点数的计算过程是：先将浮点数转化为二进制，然后进行计算，再转化为十进制，这样子会有少许的误差，所以为了避免这种误差我们可先将浮点数乘以10的n次方，转化为整数计算，然后再转化为小数。</p>
</blockquote>
<p>----来自团队的总结</p>
<script type="text/javascript" src="http://assets.taobaocdn.com/app/tms/tms-edit-link.js"></script>]]></description>
</item>
<item>
<title><![CDATA[每日一Tip_JS跨域]]></title>
<link>http://www.xintend.com/Article/SqIwxMjCbQXOrtStYuXC.aspx</link>
<category><![CDATA[心得]]></category>
<author>KingFo</author>
<pubDate>2010-03-10 09:45:54Z</pubDate>
<description><![CDATA[<p>&nbsp;</p>
<script type="text/javascript" src="http://assets.taobaocdn.com/app/tms/tms-edit-link.js"></script> <blockquote>
<p>Chrome<font face="宋体" color="#000000" style="font-size: 10pt;"> || Firefox中将同一域名下不同端口的访问也视为跨域操作。(JS)<br />
<br />
</font></p>
</blockquote>
<p>-----来自团队总结</p>
<script type="text/javascript" src="http://assets.taobaocdn.com/app/tms/tms-edit-link.js"></script>]]></description>
</item>
</channel>
</rss>