0

WebspherePortalServerにいくつかのポートレットがデプロイされています。cssファイルには、imgタグの動作属性が含まれています。

img {
    position:relative;
    border:none;
    outline:none;
    behavior: expression((this.runtimeStyle.behavior="none")&&(this.pngSet?this.pngSet=true:(this.nodeName == "IMG" && this.src.toLowerCase().indexOf('.png')>-1?(this.runtimeStyle.backgroundImage = "none", this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.src + "', sizingMethod='image')", this.src = "transparent.gif"):(this.origBg = this.origBg? this.origBg :this.currentStyle.backgroundImage.toString().replace('url("', '').replace('")', ''), this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.origBg + "', sizingMethod='crop')", this.runtimeStyle.backgroundImage = "none")), this.pngSet=true) );
}

この動作タグによって複数のHTTPリクエストが発生することがわかりました。ポートレットJSPの1つに、次のようなスタイルクラスが含まれています。

<link rel="stylesheet" type="text/css" title="Style"
    href=''<%=request.getContextPath()+"/theme/stylesheet.css" %>'>

問題は、そのrequest.getContextPath()がある場合にのみ発生します。それを実際のコンテキストルートに置き換えても、問題は発生しません。誰かがその動作属性が問題を引き起こしている理由を教えてもらえますか?

4

1 に答える 1

1

Yahoo! Webサイトを高速化するためのベストプラクティスというタイトルの記事があります。避けるべきことの1つは、マウスを動かすかページをスクロールするだけで、予想よりも少し頻繁に評価されるCSSの式です。

この記事をここで読んで、「 CSS式を避ける」という見出しを探すことができます。

http://developer.yahoo.com/performance/rules.html

于 2010-07-09T04:37:45.050 に答える