- 浏览: 1434058 次
- 性别:
- 来自: 上海
文章分类
最新评论
-
luhouxiang:
写的很不错,学习了
Extjs 模块化动态加载js实践 -
kingkongtown:
如果想改成淘宝后台那样,可以在编辑器批量上传图片呢?
kissy editor 阶段体会 -
317966578:
兄弟我最近也在整jquery和caja 开放一些接口。在git ...
caja 原理 : 前端 -
liuweihug:
Javascript引擎单线程机制及setTimeout执行原 ...
setTimeout ,xhr,event 线程问题 -
辽主临轩:
怎么能让浏览器不进入 文档模式的quirks模式,进入标准的
浏览器模式与文本模式
Ext.apply(Ext.DomHelper, function(){ var pub, afterbegin = 'afterbegin', afterend = 'afterend', beforebegin = 'beforebegin', beforeend = 'beforeend'; // private function doInsert(el, o, returnElement, pos, sibling, append){ el = Ext.getDom(el); var newNode; //错了,由于闭包,不能在外部设置useDom=true了。 if (pub.useDom) { //应该为 Ext.DomHelper.useDom newNode = createDom(o, null); if (append) { el.appendChild(newNode); } else { (sibling == 'firstChild' ? el : el.parentNode).insertBefore(newNode, el[sibling] || el); } } else { newNode = Ext.DomHelper.insertHtml(pos, el, Ext.DomHelper.createHtml(o)); } return returnElement ? Ext.get(newNode, true) : newNode; } // build as dom /** @ignore */ function createDom(o, parentNode){ var el, doc = document, useSet, attr, val, cn; if (Ext.isArray(o)) { // Allow Arrays of siblings to be inserted el = doc.createDocumentFragment(); // in one shot using a DocumentFragment Ext.each(o, function(v) { createDom(v, el); }); } else if (Ext.isString(o)) { // Allow a string as a child spec. el = doc.createTextNode(o); } else { el = doc.createElement( o.tag || 'div' ); useSet = !!el.setAttribute; // In IE some elements don't have setAttribute Ext.iterate(o, function(attr, val){ if(!/tag|children|cn|html|style/.test(attr)){ if(attr == 'cls'){ el.className = val; }else{ if(useSet){ el.setAttribute(attr, val); }else{ el[attr] = val; } } } }); pub.applyStyles(el, o.style); if ((cn = o.children || o.cn)) { createDom(cn, el); } else if (o.html) { el.innerHTML = o.html; } } if(parentNode){ parentNode.appendChild(el); } return el; } pub = { /** * Creates a new Ext.Template from the DOM object spec. * @param {Object} o The DOM object spec (and children) * @return {Ext.Template} The new template */ createTemplate : function(o){ var html = Ext.DomHelper.createHtml(o); return new Ext.Template(html); }, /** True to force the use of DOM instead of html fragments @type Boolean */ useDom : false, /** * Applies a style specification to an element. * @param {String/HTMLElement} el The element to apply styles to * @param {String/Object/Function} styles A style specification string e.g. 'width:100px', or object in the form {width:'100px'}, or * a function which returns such a specification. */ applyStyles : function(el, styles){ if(styles){ var i = 0, len, style; el = Ext.fly(el); if(Ext.isFunction(styles)){ styles = styles.call(); } if(Ext.isString(styles)){ styles = styles.trim().split(/\s*(?::|;)\s*/); for(len = styles.length; i < len;){ el.setStyle(styles[i++], styles[i++]); } }else if (Ext.isObject(styles)){ el.setStyle(styles); } } }, /** * Creates new DOM element(s) and inserts them before el. * @param {Mixed} el The context element * @param {Object/String} o The DOM object spec (and children) or raw HTML blob * @param {Boolean} returnElement (optional) true to return a Ext.Element * @return {HTMLElement/Ext.Element} The new node * @hide (repeat) */ insertBefore : function(el, o, returnElement){ return doInsert(el, o, returnElement, beforebegin); }, /** * Creates new DOM element(s) and inserts them after el. * @param {Mixed} el The context element * @param {Object} o The DOM object spec (and children) * @param {Boolean} returnElement (optional) true to return a Ext.Element * @return {HTMLElement/Ext.Element} The new node * @hide (repeat) */ insertAfter : function(el, o, returnElement){ return doInsert(el, o, returnElement, afterend, 'nextSibling'); }, /** * Creates new DOM element(s) and inserts them as the first child of el. * @param {Mixed} el The context element * @param {Object/String} o The DOM object spec (and children) or raw HTML blob * @param {Boolean} returnElement (optional) true to return a Ext.Element * @return {HTMLElement/Ext.Element} The new node * @hide (repeat) */ insertFirst : function(el, o, returnElement){ return doInsert(el, o, returnElement, afterbegin, 'firstChild'); }, /** * Creates new DOM element(s) and appends them to el. * @param {Mixed} el The context element * @param {Object/String} o The DOM object spec (and children) or raw HTML blob * @param {Boolean} returnElement (optional) true to return a Ext.Element * @return {HTMLElement/Ext.Element} The new node * @hide (repeat) */ append: function(el, o, returnElement){ return doInsert(el, o, returnElement, beforeend, '', true); }, /** * Creates new DOM element(s) without inserting them to the document. * @param {Object/String} o The DOM object spec (and children) or raw HTML blob * @return {HTMLElement} The new uninserted node */ createDom: createDom }; return pub; }());
//错了,由于闭包,不能在外部设置useDom=true了。
if (pub.useDom) {
//应该为 Ext.DomHelper.useDom
有些情况需要 设置 Ext.DomHelper.useDom =true
如:
Ext.DomHelper 添加 option 问题
现在 Extjs 3.0 设置后无效了
另外发现 ext-core 3.0 和 extjs 3.0 完全版 相同功能的代码实现有些不一样,如 ext-core 3.0 DomHelper 根本没上述代码,也就是说 core 不能用dom方式了 ,好像 core 是 完全版的 简化降级形式 ,太不爽了!很多有用的基础函数都在core里被删掉了,完全版还有,看来要定制一个自己的core了!
发表评论
-
模块化高扩展性的前端框架 KISSY
2013-03-14 14:58 8554模块化高扩展性的前端框架 KISSY 注:本文为 2 ... -
构建前端 DSL
2012-10-11 22:10 5285目前在传统的软件开 ... -
KISSY kisses bootstrap navbar
2012-08-03 01:12 5958看了下 bootstrap 的导航菜单,立刻非常喜欢,注意是浅 ... -
promise api 与应用场景
2012-02-07 17:34 7289promise 是 commonjs 社区中提出的异步规范,其 ... -
unified event model
2011-10-14 23:02 1749为了处理原生事件在各 ... -
转载:瀑布流布局浅析
2011-09-29 19:02 2788简介 如果你经 ... -
cross domain request
2011-09-29 18:39 2791场景 跨域请求是随着 ... -
基于多继承的树设计
2011-09-18 03:42 2205分类 树是一种常见 ... -
caja 原理 : 前端
2011-09-01 16:48 6944作为前端开放的基础安全保证,caja 是目前比较合 ... -
ie 下 cloneNode 导致的属性克隆
2011-08-24 16:10 2416这个还是很值得记下,一直存在的很大隐患终于解决,由于在 ie& ... -
just another event model
2011-06-08 20:47 2126事件模型也算是客户端兼容性的一个长期问题,早期 jquery ... -
框架 build 系统介绍
2010-07-11 01:29 1594一个复杂的类库通常都包括很多子模块( jquery@git ... -
querySelectorAll 探讨
2010-07-01 22:35 4441随着css selector engine在越来越多的java ... -
再谈 attribute
2010-06-22 11:37 2567@slideshare 原生: ... -
事件机制探讨
2010-06-21 13:54 2179由于浏览器事件机制的不兼容性,譬如最常见的注册事件差异 ... -
利用Attribute重构:业务与UI分离
2010-06-08 16:54 1539很简单的一个应用 通过按钮来限制输入范围 ,这样的话再 ... -
yui3 loader的串行加载特性
2010-06-04 12:30 1771yui3 的沙箱机制可以在 ... -
yui3下的load事件触发
2010-06-01 13:31 3163以前的一些总结:页面l ... -
理解YUI3 extension:Base.create
2010-05-31 03:01 1959YUI3中为了避免不必要的类继承层次,以及摆脱利用原型链模拟的 ... -
google WebFont Loader 源码阅读
2010-05-22 01:04 2720资料: 关于新发 ...
相关推荐
绝对的ExtJS3.0中文API,本人在网上找了好久才找到的,在此奉献给大家!!解压后有30多兆!!
extJS3.0 extJS3.0 extJS3.0 extJS3.0 extJS3.0 extJS3.0 extJS3.0
ExtJS3.0 源码分析与开发实例宝典
Extjs3.0中文API文档 够详细 够详细 够详细
由于extjs3.0自己封装的时间不能够选择时分秒,给大家开发带来了一些麻烦。虽然网上有ext2.0的日期扩展控件,但在3.0中不能用。公司现在项目正用了,因此我就对extjs3.0时间控件的扩展,实现了可选择时分秒功能。...
extjs3.0框架extjs3.0框架extjs3.0框架extjs3.0框架
1、Extjs3.0 常用组件介绍ppt 2、怎样安装开发利器Spket 3、Spket安装包
在网络上搜集,自己安装成功后在使用的开发环境。因ExtJS3.0和spket-1.6.18.jar的开发包太大不能上传,里面有安装说明和下载路径 ext-jsb2.zip jsb2是最新的。。请所需者取之
ExtJs3.0API,希望对大家有所帮助
extjs框架,学习,开发,extjs3.0开发包以及文档
extjs3.0开发包包含api、例子、源文件等,简单易用,
ExtJS 3.0 学习资源,有兴趣的 可以下载看看!!!!
ExtJS 3.0 API 文档离线包,
真正的ExtJS 3.0可视化开发工具,支持WebUI和Code可视化设计.
ExtJSweb 开发指南中的 简单图书管理系统 ExtJS3.0+spring+hibernate+struts
extjs3.0中英文对照chm api
EXT登陆,整合STRUTS2,SPRING,IBATIS,EXTJS3.0,详细的请看看代码,因为jar包较大,暂不加jar包。的请看看代码,因为jar包较大,暂不加jar包
extjs3.0.chm API extjs3.0.chm API extjs3.0.chm API extjs3.0.chm API
深入浅出 Extjs3.0 中文文档,深入浅出 Extjs3.0 中文文档
ExtJs3.0 中文破解视图编辑器.rar AIR安装程序 Ext 帮组文档 你的支持就是我上传的动力 资源共享