<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>welefen的随笔</title>
	<atom:link href="http://www.welefen.com/tag/js/feed" rel="self" type="application/rss+xml" />
	<link>http://www.welefen.com</link>
	<description>前端打杂者@baidu</description>
	<lastBuildDate>Tue, 07 Feb 2012 07:28:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>tangram最优定制版codesearch工具</title>
		<link>http://www.welefen.com/optimize-of-tangram-codesearch.html</link>
		<comments>http://www.welefen.com/optimize-of-tangram-codesearch.html#comments</comments>
		<pubDate>Fri, 21 Oct 2011 07:40:06 +0000</pubDate>
		<dc:creator>welefen</dc:creator>
				<category><![CDATA[前端开发]]></category>
		<category><![CDATA[baidu]]></category>
		<category><![CDATA[codesearch]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[tangram]]></category>
		<category><![CDATA[定制]]></category>
		<category><![CDATA[开源]]></category>
		<category><![CDATA[框架]]></category>

		<guid isPermaLink="false">http://www.welefen.com/?p=948</guid>
		<description><![CDATA[tangram是什么 tangram是百度前端开发团队开发的一款JS框架，该框架具有一下特点： 可通过定制创建最适合的轻量级版本 多种机制实现扩展，良好的插件支持 丰富的中文文档以及案例，容易上手 全浏览器跨平台兼容 平滑的版本升级体验 tangram codesearch tangram codesearch是一个tangram方法定制的工具，他可以定制你需要的tangram方法，将没使用到的方法去除，从而减少文件的大小，提升加载速度。 但在真正开发和使用这个工具的时候，你会发现这个工具很鸡肋，为什么呢？主要有下面几个原因： 项目之初你可能根本不知道你要用到哪些方法，可能只能将一些最基本的方法选定，待开发过程中慢慢去重新定制。这种方式非常耗费时间。 项目之初使用全部的tangram，项目完成时统计使用到哪些方法，然后将这些方法打包。首先统计需要耗费一定的时间，其次升级时都要做这个事情很麻烦。如果有哪个方法不在使用了，可能并不会删除。 由于上面2种定制方式都带来很多问题，所以一般情况下直接使用全量的tangram，不再考虑使用定制的tangram了。 有没有办法解决这个问题呢？ 如果有一种工具，可以自动分析开发的代码中使用到哪些tangram方法，然后将这些方法打包，那就可以很好的解决这个问题了。 最优定制版tangram codesearch 最优定制版tangram codesearch就是这样一款工具，这个工具可以让你在开发的时候直接使用全亮的tangram，然后在上线之前将开发的JS打成zip包，然后上传，系统就可以自动分析代码里使用了哪些tangram方法，并自动将这些方法打包。然后将最优定制后的文件覆盖原有的问题就可以了。 在线地址：http://www.welefen.com/lab/tangram-codesearch/index.html 虽然这个工具可以很好的解决定制的问题，但是也不是十分完美的，目前主要有下面几个缺点： 自动分析只是做了简单的识别，只识别代码中直接使用tangram里的方法，如：使用了baidu.dom.g, baidu.array.each。 不能识别如下的情况，如果有下面的情况暂时请手工添加： 定义了变量var a = baidu.array, 然后使用a.each 通过methodize，multize等方法后，然后使用该方法，如：将dom的很多方法集化到Element类上，然后使用类的方法 通过extend将一个对象的方法扩展到另一个对象上，如：baidu.extend(a, baidu.array)， 然后使用a.each 相关文章 百度新首页性能优化 续: 如何减少代码上线过程中对服务的影响 新百度首页 音乐电台chrome插件发布2.0版本 Imghash:相似图片搜索的php实现]]></description>
		<wfw:commentRss>http://www.welefen.com/optimize-of-tangram-codesearch.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>按字节截取字符串</title>
		<link>http://www.welefen.com/substr-by-byte.html</link>
		<comments>http://www.welefen.com/substr-by-byte.html#comments</comments>
		<pubDate>Tue, 09 Mar 2010 04:02:58 +0000</pubDate>
		<dc:creator>welefen</dc:creator>
				<category><![CDATA[前端开发]]></category>
		<category><![CDATA[byte]]></category>
		<category><![CDATA[js]]></category>

		<guid isPermaLink="false">http://www.welefen.com/?p=273</guid>
		<description><![CDATA[在JS中，由于中文和英文是同等对待的，但有时候我们希望是一个中文按两个字节算，这就出现了按字节截取字符串的功能。下面列举了 2种实现方式。 循环检测 这种实现方式来自于Tangram，具体实现如下： baidu.string.getByteLength = function (source) { return String(source).replace(/[^\x00-\xff]/g, “ci”).length; }; /* * Tangram * Copyright 2009 Baidu Inc. All rights reserved. * * path: baidu/string/subByte.js * author: dron, erik * version: 1.1.0 * date: 2009/11/30 */ /** * 对目标字符串按gbk编码截取字节长度 * * @param {string} source 目标字符串 * @param {number} length 需要截取的字节长度 * @return [...]]]></description>
		<wfw:commentRss>http://www.welefen.com/substr-by-byte.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>js动态创建类和实例化</title>
		<link>http://www.welefen.com/js%e5%8a%a8%e6%80%81%e5%88%9b%e5%bb%ba%e7%b1%bb%e5%92%8c%e5%ae%9e%e4%be%8b%e5%8c%96.html</link>
		<comments>http://www.welefen.com/js%e5%8a%a8%e6%80%81%e5%88%9b%e5%bb%ba%e7%b1%bb%e5%92%8c%e5%ae%9e%e4%be%8b%e5%8c%96.html#comments</comments>
		<pubDate>Wed, 24 Feb 2010 08:39:34 +0000</pubDate>
		<dc:creator>welefen</dc:creator>
				<category><![CDATA[前端开发]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[instance]]></category>
		<category><![CDATA[js]]></category>

		<guid isPermaLink="false">http://www.welefen.com/?p=265</guid>
		<description><![CDATA[在js中，创建一个类和实例化该类一般方式是： var cls = function(){} cls.prototype = { attr:”, method:function(){} } var clsInstance = new cls; 这种方式简单明了，但如果类很多的话就比较痛苦了，并且代码看起来不够优化。 动态创建类 动态创建类实际上类似于一种代理的模式，代码如下： var Fath = function(methods){ var cls = function(){ return new fn(arguments); }, fn = function(args){ return this.init &#38;&#38; this.init.apply &#38;&#38; this.init.apply(this,args); }; fn.prototype = cls.prototype = methods &#124;&#124; {}; try{ return cls; }finally{ cls = null; [...]]]></description>
		<wfw:commentRss>http://www.welefen.com/js%e5%8a%a8%e6%80%81%e5%88%9b%e5%bb%ba%e7%b1%bb%e5%92%8c%e5%ae%9e%e4%be%8b%e5%8c%96.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>javascript数组唯一化实现方式</title>
		<link>http://www.welefen.com/javascript-array-unique.html</link>
		<comments>http://www.welefen.com/javascript-array-unique.html#comments</comments>
		<pubDate>Mon, 07 Dec 2009 05:10:18 +0000</pubDate>
		<dc:creator>welefen</dc:creator>
				<category><![CDATA[前端开发]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[unique]]></category>
		<category><![CDATA[唯一化]]></category>
		<category><![CDATA[数组]]></category>

		<guid isPermaLink="false">http://www.welefen.com/?p=104</guid>
		<description><![CDATA[到目前为止，javascript中array还没有内置的unique方法，本来这篇文章很早就写了，但由于之前的虚拟主机忘记续费导致数据丢了，前几天JerryQu问了我这个问题，觉得可能还有其他人要，这里在写出来，备大家参考。 实现方式 这里给出2中实现方式。一种是大家应该都知道的indexOf检测的方式，另一种是结合lastIndexOf和splice实现方式。 //首先给Array对象原型上添加indexOf和lastIndexOf方法.(如果没有的话) if(!Array.prototype.indexOf){ Array.prototype.indexOf = function(element, index){ var length = this.length; if(index == null){ index = 0; }else{ index = +index &#124;&#124; 0; if(index < 0) index+= length; if(index < 0) index = 0; } for(var current;index= length) index = length &#8211; 1; } for(var current;index>=0;index&#8211;){ current = this[index]; if(current === element) return [...]]]></description>
		<wfw:commentRss>http://www.welefen.com/javascript-array-unique.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using eaccelerator
Database Caching 1/13 queries in 0.010 seconds using disk: basic
Object Caching 477/499 objects using disk: basic

Served from: welefen.com @ 2012-02-08 03:20:43 -->
