- 浏览: 399713 次
- 性别:
- 来自: 上海
文章分类
- 全部博客 (309)
- xaml C# wpf (0)
- scala java inner clas (1)
- Tools UML Eclipse UML2 (1)
- Timer .NET Framework (1)
- perl (6)
- python function paramter (1)
- Python Docstring (1)
- Python how to compare types (1)
- Python (8)
- java (5)
- C# (76)
- C# WPF (0)
- p4 (0)
- WPF (46)
- .net (6)
- xaml (1)
- javascript (40)
- windows (10)
- scala (4)
- winform (1)
- c++ (48)
- tools (12)
- cmd (1)
- os (0)
- CI (0)
- shell (0)
- C (2)
- haskell (49)
- functional (1)
- tool (1)
- gnu (1)
- linux (1)
- kaskell (0)
- svn (0)
- wcf (3)
- android (1)
最新评论
expando is something like this
elem.attr, or you can use something like this: elem[attr];
while attribute is something like this:
elem.getAttribute("attr_name");
there are something about expando that you should know.
- First, the naming of expandos are generally more consistent across browsers.
- Second, expandos have some name limitations as to what names they are capable of using.
- Third, expando properties don't exist on XML nodes.Expando properties are primarily only available on HTML documents
- Fourth, it should be noted that not all attributes become an expando, custom ones does not become expando, you may do some test before access the custom expando, and fall back to attributes way if necessary
- Last, and perhaps most importantly, expandos are much, much, faster than their corresponding DOM attribute operations (especially so in Internet Explorer).
below shows the code access the attriute of some elements, while in prefer to expandos.
/************************************** *@Name: expandoattr.js *@Summary * this shows the example of how you make use of the expando and others.. * * ***************************************/ (function () { // map expando names, the primarily reason for why the expando name mapping is because some are reserved world. and some are key words var map = { "for": "htmlFor", "class": "className", readonly: "readOnly", maxlength: "maxLength", cellspacing: "cellSpacing", rowspan: "rowSpan", colspan: "colSpan", tabindex: "tabIndex" }; this.attr = function (elem, name, value) { var expando = map[name] || name, expandoExists = typeof elem[expando] !== "undefined"; if (typeof value != "undefined") { // this attribute tells where or not you can use the expando attributes if (expandoExists) { elem[expando] = value; } else { elem.setAttribute(name, value); } return expandoExists ? elem[expando] : elem.getAttribute(name); } }; })();
发表评论
-
javascript - trick to cross browser DOM ready event
2012-08-24 08:23 928the "ready" event ... -
javascript - trick to simulate mouseenter and mouseleave
2012-08-23 08:31 2254Previously we discussed javasc ... -
javascript - trick to simulate the change event
2012-08-22 08:51 1659In the previous discussion a ... -
javascript - trick to simulate bubbling submit event
2012-08-22 08:03 906In the previous discussion abou ... -
javascript - trick to implement bubbling submit event
2012-08-23 07:55 700Following up to the javascrip ... -
javascript - trick to detect bubbling supportability
2012-08-20 22:22 971Event delegation is oe of the b ... -
javascript - trigger event and custom events
2012-08-20 21:58 2078In the previous post - javascri ... -
javascript - trick to handlers management
2012-08-20 08:19 1024We have discussed "javascr ... -
javascript - trick to centralized store
2012-08-20 07:52 818For a number of reasons it's ... -
javascript - trick to fix the event object
2012-08-20 07:47 881Many browsers, especially In ... -
javascript - tricks to deal with colors
2012-08-15 08:34 766There are a couple of ways to r ... -
javascript - trick to manipulate the opacity
2012-08-15 08:26 766All other browsre may have supp ... -
javascript - trick to test visibility of an element
2012-08-15 08:15 522though there is a visible prope ... -
javascript - trick to get and set height and width
2012-08-15 08:05 549when looking at properties t ... -
javascript - trick to set/get attributes that expects px values
2012-08-16 11:00 516When setting a number into a ... -
javascript - trick to get and set CSS style
2012-08-16 11:00 747while it will not be so much tr ... -
javascript - trick to normalize href for IE
2012-08-16 10:59 533IE is again the only browser th ... -
javascript - trick IE form and its expando attribute
2012-08-16 10:59 1041there is a known issue that if ... -
javascript - trick to getText and setText
2012-08-14 07:40 1144it is not as simple as you thin ... -
javascript - trick/guideline to remove DOM element
2012-08-14 07:00 1178remove an element is not as sim ...
相关推荐
服务器端C#代码成功地设置了`<title>`元素的`InnerHtml`和`Attributes`,但在客户端JavaScript中,`icon`属性始终无法正确获取,原因是`<title>`元素不支持静态Expando属性。 首先,让我们看看两种添加Expando属性...
总的来说,"expando.github.com"项目提供了一个实践和学习HTML、CSS和JavaScript的好机会,特别是对于想要了解如何在GitHub上管理和分享自己的网页项目的人来说。通过这个项目,你可以深入理解网页开发的流程,并...
在Liferay Portal中,"rule-expando"是一个用于定制化用户受众群体定位的工具,它允许管理员和开发者根据用户的不同属性或扩展数据来定义规则,从而实现精细化的内容分发和服务提供。这个工具的核心是利用了Liferay...
【标题】"The-Expando: 首次尝试DKC NextJS-Firebase Web应用程序" 在Web开发领域,Next.js和Firebase是两个非常流行的技术框架,它们分别在服务器端渲染(SSR)和云服务方面提供了强大的解决方案。The-Expando项目...
这个功能主要依赖JavaScript来实现,其中提到了一个名为"expando.js"的JS封装类。下面将详细介绍这一技术实现及其相关的JavaScript知识点。 1. **JavaScript基础**:JavaScript是一种广泛使用的客户端脚本语言,它...
这个方法适用于所有浏览器,但会导致原先绑定的事件监听器丢失,以及自定义的扩展属性(expando attributes)被清除。代码如下: ```javascript function clearInputFile(f) { var form = document....
jquery.expando 一个jQuery插件,用于制作随您而生的文本 要查看此插件的运行情况,请查看 。 用法 选项1:适用于IE 9,Chrome,Firefox,Safari。 <!doctype html> <html> <head> <title>...
根据 JavaScript 规范,函数表达式中的标识符不应该在函数体外可访问,但在某些 JavaScript 引擎实现中(如 JScript),标识符 `g` 却可以在外围作用域中被识别。这导致了标识符 `g` 污染了外围作用域,如果该作用域...
一、实现原理: ...对于Javascript对象,数据则直接存储在该Javascript对象的属性jQuery.expando上。在读取、设置、移除数据时,实际上是对Javascript对象的数据缓存对象执行读取、设置、移除操作。 为了避免jQu
这个方法解决了 JavaScript 中与 DOM 元素直接关联数据可能导致的内存泄漏问题。 在JavaScript中,当我们直接在 DOM 元素上添加自定义属性并赋值为 JavaScript 对象时,如果这个对象不再被其他变量引用,按理说它...
对于JavaScript对象,数据直接存储在对象的`jQuery.expando`属性上。 内部数据和用户自定义数据是分开存储的,内部数据存储在数据缓存对象上,而用户自定义数据存储在`data`属性下,以避免两者之间的冲突。 二、...
jQuery是一个广泛使用的JavaScript库,它提供了许多方便的API,其中就包括了强大的缓存机制。缓存系统在优化性能、减少不必要的网络请求以及管理DOM元素的数据方面起着至关重要的作用。本文将探讨jQuery的缓存机制,...
JSON(JavaScript Object Notation)是一种轻量级的数据交换格式,被广泛用于Web应用程序之间传递数据。在某些场景下,我们可能需要处理具有动态键名的JSON对象,这意味着键名在运行时可能根据不同的条件变化。在...
进一步研究,我们发现在Groovy的`groovy.util.Expando`类中,`hashCode`和`toString`方法都调用了`MethodClosure#call()`。这意味着只要这些对象被用于哈希数据结构,就可能触发恶意行为。例如,当攻击者控制的数据...
jqueryData jquery.data.2.0.3.js jQuery 2.0.3版具有1.8.0版中的扩展功能。 例子用于查找元素的功能事件。 $(element).data('events') $._data('element', 'events')
在Web开发中,我们经常使用JavaScript对DOM进行操作,以便动态地改变网页内容和布局。 jQuery是一个轻量级的JavaScript库,它通过封装常见的DOM操作,让开发者能够更便捷地操作DOM元素。在jQuery中,可以通过简洁的...