Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornsandonato2009-10-12 14:20:28 +0000
committernsandonato2009-10-12 14:20:28 +0000
commitefe049945f1705072bc61c2e6220997527b85996 (patch)
treea9f23092e3dadb3fb58d44e6aef5a75cc3ffa941 /bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html
parent5a9158b8bf293e35be4dba3ea60f3c17adc475d6 (diff)
downloadwebtools.sourceediting-efe049945f1705072bc61c2e6220997527b85996.tar.gz
webtools.sourceediting-efe049945f1705072bc61c2e6220997527b85996.tar.xz
webtools.sourceediting-efe049945f1705072bc61c2e6220997527b85996.zip
[290149]
Diffstat (limited to 'bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html')
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/htmlcss/HTMLStyleSelectorAdapter.java13
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/htmlcss/LinkElementAdapter.java11
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/htmlcss/StyleElementAdapter.java2
3 files changed, 11 insertions, 15 deletions
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/htmlcss/HTMLStyleSelectorAdapter.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/htmlcss/HTMLStyleSelectorAdapter.java
index abcd5ff0ba..cee65d1423 100644
--- a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/htmlcss/HTMLStyleSelectorAdapter.java
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/htmlcss/HTMLStyleSelectorAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
+ * Copyright (c) 2004, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -67,8 +67,7 @@ public class HTMLStyleSelectorAdapter implements IStyleSelectorAdapter {
if (i > 0) {
if (i > 1)
return false;
- key = element.getAttribute("id");//$NON-NLS-1$
- if (key == null || key.length() == 0)
+ if (!element.hasAttribute("id") || (key = element.getAttribute("id")).length() == 0)//$NON-NLS-1$ //$NON-NLS-2$
return false;
if (!selector.getID(0).equals(key))
return false;
@@ -77,8 +76,7 @@ public class HTMLStyleSelectorAdapter implements IStyleSelectorAdapter {
// check class
i = selector.getNumOfClasses();
if (i > 0) {
- key = element.getAttribute("class");//$NON-NLS-1$
- if (key == null|| key.length() == 0)
+ if (!element.hasAttribute("class") || (key = element.getAttribute("class")).length() == 0) //$NON-NLS-1$ //$NON-NLS-2$
return false;
StringTokenizer tokenizer = new StringTokenizer(key);
for (i = i - 1; i >= 0; i--) {
@@ -99,8 +97,9 @@ public class HTMLStyleSelectorAdapter implements IStyleSelectorAdapter {
StringTokenizer tokenizer = new StringTokenizer(selector.getAttribute(i), "=~| \t\r\n\f");//$NON-NLS-1$
int countTokens = tokenizer.countTokens();
if (countTokens > 0) {
- String attrValue = element.getAttribute(tokenizer.nextToken());
- if (attrValue == null || attrValue.length() == 0)
+ String attrName = tokenizer.nextToken();
+ String attrValue = null;
+ if (!element.hasAttribute(attrName) || (attrValue = element.getAttribute(attrName)).length() == 0)
return false;
if (countTokens > 1) {
String token = tokenizer.nextToken("= \t\r\n\f");//$NON-NLS-1$
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/htmlcss/LinkElementAdapter.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/htmlcss/LinkElementAdapter.java
index 902beda5f1..6113d4b3d6 100644
--- a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/htmlcss/LinkElementAdapter.java
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/htmlcss/LinkElementAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
+ * Copyright (c) 2004, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -201,14 +201,11 @@ public class LinkElementAdapter extends AbstractStyleSheetAdapter {
Element element = getElement();
if (element == null)
return false;
- String rel = element.getAttribute("rel");//$NON-NLS-1$
- if (rel == null || !rel.equalsIgnoreCase("stylesheet"))//$NON-NLS-1$
+ if (!element.hasAttribute("rel") || !"stylesheet".equalsIgnoreCase(element.getAttribute("rel")))//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
return false;
- String type = element.getAttribute("type");//$NON-NLS-1$
- if (type != null && !type.equalsIgnoreCase("text/css"))//$NON-NLS-1$
+ if (element.hasAttribute("type") && !"text/css".equalsIgnoreCase(element.getAttribute("type")))//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
return false;
- String href = element.getAttribute("href");//$NON-NLS-1$
- if (href == null || href.length() == 0)
+ if (!element.hasAttribute("href") || element.getAttribute("href").length() == 0) //$NON-NLS-1$ //$NON-NLS-2$
return false;
return true;
}
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/htmlcss/StyleElementAdapter.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/htmlcss/StyleElementAdapter.java
index c9a6abc776..94beee70d8 100644
--- a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/htmlcss/StyleElementAdapter.java
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/htmlcss/StyleElementAdapter.java
@@ -198,7 +198,7 @@ public class StyleElementAdapter extends AbstractStyleSheetAdapter implements IS
return false;
}
String type = element.getAttribute(HTML40Namespace.ATTR_NAME_TYPE);
- if (type != null && type.length() > 0 && !type.equalsIgnoreCase("text/css")) { //$NON-NLS-1$
+ if (element.hasAttribute(HTML40Namespace.ATTR_NAME_TYPE) && type.length() > 0 && !type.equalsIgnoreCase("text/css")) { //$NON-NLS-1$
return false;
}
return true;

Back to the top