Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

data模块的parseData的改进 #8

Open
RubyLouvre opened this issue Apr 6, 2012 · 0 comments
Open

data模块的parseData的改进 #8

RubyLouvre opened this issue Apr 6, 2012 · 0 comments

Comments

@RubyLouvre
Copy link
Owner

此方法是对应jQuery data模块的dataAttr私有方法,将单一的字符串数据转换成多元化的数据。

问题是jQuery内部是使用$.parseJSON进行转换,这就要求对象的键名一定要用双引号括起来相当麻烦。

parseData的改进是,直接使用eval("0,"+data)进行转换,这样一来保存对象就非常简单了,同时我们还可以保存时间对象,函数,正则,NaN等等,非常方便

parseData的加入,让mass Framework现在有五个parseXXX方法了,依次是parseJSON, parseJS,parseXML,parseHTML,parseData

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant