Google Groups Home
Help | Sign in
$import 的特殊要求还是BUG?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
winsteps  
View profile
 More options Dec 15 2007, 4:36 am
From: winsteps <winst...@gmail.com>
Date: Sat, 15 Dec 2007 01:36:40 -0800 (PST)
Local: Sat, Dec 15 2007 4:36 am
Subject: $import 的特殊要求还是BUG?
$import函数

导入指定元素(函数、类、变量、样式)至指定目标,默认方式为同步导入,默认目标为全局对象(Global == window(html))。

IE下的BUG???抑或对上述语句理解不够?

将导入语句$improt("xx")集合统一放置在比如xx.js中,然后再调用出错。

示例:
<script language="javascript" src="scripts/boot.js" type="text/
javascript"></script>
<script language="javascript" src="scripts/xx.js" type="text/
javascript"></script>

xx.js中内容为
$import("xx1");
$import("xx2");
...

错误描述:IE6、Opera 9下无法使用托管的脚本,FF正常。

请大家帮忙测试,如果是BUG,希望老大修正。

我对DOM有洁癖。


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
jindw  
View profile
 More options Dec 18 2007, 7:32 am
From: jindw <jind...@gmail.com>
Date: Tue, 18 Dec 2007 04:32:29 -0800 (PST)
Local: Tues, Dec 18 2007 7:32 am
Subject: Re: $import 的特殊要求还是BUG?
更本就不是那样用的,你先看看例子吧。

On Dec 15, 5:36 pm, winsteps <winst...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
winsteps  
View profile
 More options Dec 19 2007, 8:28 pm
From: winsteps <winst...@gmail.com>
Date: Wed, 19 Dec 2007 17:28:07 -0800 (PST)
Local: Wed, Dec 19 2007 8:28 pm
Subject: Re: $import 的特殊要求还是BUG?
标准用法code?
<!--载入boot脚本-->
<script language="javascript" src="scripts/boot.js" type="text/
javascript"></script>
<!--导入需要的类库-->
<script language="javascript">
$import("xx.xx.xx");
</script>
然后在dom里面加上事件
<div onclick="func();">....</div>
-----------------------------------------------------------------对吗?

我习惯于把行为与结构分离,即通过使用类库对ID的行为进行控制。

这样就意味着将Dom中的事件都剥离出来统一放在某个script区间。

首先估且不论我这种做法是否合理,但我认为至少是符合当前的web思想,或者可以认为是一种个人习惯。

非常欣赏JSI的托管思想,虽然没有能力和精力去读里面的代码,但好用能用也就用了。

下面我仔细阐述一下我遇到的这种情况:
-------------------A---------------------
<script language="javascript">
$import("xx.xx.xx");
</script>
------------------B----------------------
<script language="javascript">
//部分js代码
$(".top").click(function()......);//jquery的使用方法
</script>
------------------C----------------------
将B部分代码放在XX.js文件里
<script language="javascript" src="xx.js" type="text/javascript"></
script>
-------------------------------------------
如果认为开头部分的标准用法没错的话。

那么A+B的用法是正常且有效的。

因为B部分通常较冗长,所以我使用A+C的做法,将代码统一放在xx.js中。

这时候问题就出现了。

在FF下一切OK,但IE、Opera就出现了问题,托管的脚本无法调用。

也就是说,import导入以后,必须在本页面作用域内使用。
1、将$import语句及调用语句都放在xx.js中
2、在页面中import,调用语句集成在xx.js中
这两种情况都不行。

为什么向jin说这个问题,我觉得既然在FF中是正常的,那么说明这个问题还是可以改进的。

如果说上述内容违背了jsi的思想,那么我感到很遗憾。

On 12月18日, 下午8时32分, jindw <jind...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
jindw  
View profile
 More options Dec 22 2007, 1:12 am
From: jindw <jind...@gmail.com>
Date: Fri, 21 Dec 2007 22:12:33 -0800 (PST)
Local: Sat, Dec 22 2007 1:12 am
Subject: Re: $import 的特殊要求还是BUG?
问题是你没有把问题描述清楚,包括现在,依然没有描述清楚。也许你真的碰到问题了,可是你的描述里没有问题!
我作为JSI的作者,看起来还是一头雾水,不知道还有谁能看明白了。

零星列举几点,或许对你有用。

1.你的xx.js也可以放包里面
$import("app/xx.js");
2.JSI主要功能不是导入,是依赖管理,隔离。而依赖管理不是通过$import实现的,不然就和JSVM没什么两样了。
3.我没有能力解答一个自己看不明白的问题。

On Dec 20, 9:28 am, winsteps <winst...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
winsteps  
View profile
 More options Dec 23 2007, 9:44 pm
From: winsteps <winst...@gmail.com>
Date: Sun, 23 Dec 2007 18:44:18 -0800 (PST)
Local: Sun, Dec 23 2007 9:44 pm
Subject: Re: $import 的特殊要求还是BUG?
受打击了,还给整复杂了?

没有怀疑JSI脚本托管的意思~~

其实我认为的问题只是将类库脚本托管给JSI以后使用时的问题。

导入以后这样使用<div onlick="javascript:func();">...</div>当然是没有问题的。

只是我个人习惯把这些onclick行为放在自定义的xx.js文件里。

这样可能就导致了脚本的跨域使用了。反过来说就是导入JSI托管的方法只能在本页面域内使用。

$import("app/xx.js")准备试一下,希望这次我把问题说明白了。

On 12月22日, 下午2时12分, jindw <jind...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google