Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNitin Dahyabhai2019-08-19 18:46:01 -0400
committerNitin Dahyabhai2019-08-19 18:47:24 -0400
commit41a1f8c587e1d34567fe9317054b6176d0b48e28 (patch)
treebd6daa682c2f82b4a96d91db8cb4a930bdfd0b60
parentfca71dd5000a3bd197f12ee5723aa0f0cb1c657a (diff)
downloadwebtools.sourceediting-41a1f8c587e1d34567fe9317054b6176d0b48e28.tar.gz
webtools.sourceediting-41a1f8c587e1d34567fe9317054b6176d0b48e28.tar.xz
webtools.sourceediting-41a1f8c587e1d34567fe9317054b6176d0b48e28.zip
[516758] HTML Editor doesn't recognize the HTML5 "main" tag
Also add the "autocomplete", "inputmode", and "is" global attributes Change-Id: I6251f8adc8c4a2633484faab958f359348562abe Signed-off-by: Nitin Dahyabhai <nitind@us.ibm.com>
-rw-r--r--web/bundles/org.eclipse.wst.html.core/META-INF/MANIFEST.MF2
-rw-r--r--web/bundles/org.eclipse.wst.html.core/pom.xml2
-rw-r--r--web/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contentmodel/HTML5AttributeCollection.java36
-rw-r--r--web/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contentmodel/HTML5ElementCollection.java9
-rw-r--r--web/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/provisional/HTML50Namespace.java15
-rw-r--r--web/tests/org.eclipse.wst.html.core.tests/META-INF/MANIFEST.MF2
-rw-r--r--web/tests/org.eclipse.wst.html.core.tests/pom.xml2
-rw-r--r--web/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/html5/model/HTML5ContentModelTest.java8
8 files changed, 63 insertions, 13 deletions
diff --git a/web/bundles/org.eclipse.wst.html.core/META-INF/MANIFEST.MF b/web/bundles/org.eclipse.wst.html.core/META-INF/MANIFEST.MF
index c903ee254..37c01235f 100644
--- a/web/bundles/org.eclipse.wst.html.core/META-INF/MANIFEST.MF
+++ b/web/bundles/org.eclipse.wst.html.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.wst.html.core; singleton:=true
-Bundle-Version: 1.3.100.qualifier
+Bundle-Version: 1.3.200.qualifier
Bundle-Activator: org.eclipse.wst.html.core.internal.HTMLCorePlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/web/bundles/org.eclipse.wst.html.core/pom.xml b/web/bundles/org.eclipse.wst.html.core/pom.xml
index 14d19721e..79472e9cc 100644
--- a/web/bundles/org.eclipse.wst.html.core/pom.xml
+++ b/web/bundles/org.eclipse.wst.html.core/pom.xml
@@ -21,6 +21,6 @@
<groupId>org.eclipse.webtools.sourceediting</groupId>
<artifactId>org.eclipse.wst.html.core</artifactId>
- <version>1.3.100-SNAPSHOT</version>
+ <version>1.3.200-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/web/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contentmodel/HTML5AttributeCollection.java b/web/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contentmodel/HTML5AttributeCollection.java
index efad0aae9..65553a697 100644
--- a/web/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contentmodel/HTML5AttributeCollection.java
+++ b/web/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contentmodel/HTML5AttributeCollection.java
@@ -24,6 +24,7 @@ public class HTML5AttributeCollection extends AttributeCollection implements HTM
/** html5 core attribs */
private static final String[] CORE = {
ATTR_NAME_ACCESSKEY,
+ ATTR_NAME_AUTOCAPITALIZE,
ATTR_NAME_CLASS,
ATTR_NAME_CONTENT_EDITABLE,
ATTR_NAME_CONTEXT_MENU,
@@ -32,8 +33,11 @@ public class HTML5AttributeCollection extends AttributeCollection implements HTM
ATTR_NAME_DROPZONE,
ATTR_NAME_HIDDEN,
ATTR_NAME_ID,
+ ATTR_NAME_INPUTMODE,
+ ATTR_NAME_IS,
ATTR_NAME_LANG,
ATTR_NAME_ROLE,
+ ATTR_NAME_SLOT,
ATTR_NAME_SPELLCHECK,
ATTR_NAME_STYLE,
ATTR_NAME_TABINDEX,
@@ -133,6 +137,14 @@ public class HTML5AttributeCollection extends AttributeCollection implements HTM
atype.setEnumValues(values);
attr = new HTMLAttrDeclImpl(ATTR_NAME_AUTOFOCUS, atype, CMAttributeDeclaration.OPTIONAL);
}
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_AUTOCAPITALIZE)) {
+ // (contenteditable (EMPTY|TRUE|FALSE|INHERIT) TRUE)
+ atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {ATTR_VALUE_ON, ATTR_VALUE_OFF, ATTR_VALUE_NONE, ATTR_VALUE_SENTENCES, ATTR_VALUE_WORDS, ATTR_VALUE_CHARACTERS};
+ atype.setEnumValues(values);
+ atype.setImpliedValue(CMDataType.IMPLIED_VALUE_DEFAULT, ATTR_VALUE_NONE);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_AUTOCAPITALIZE, atype, CMAttributeDeclaration.OPTIONAL);
+ }
else if (attrName.equalsIgnoreCase(ATTR_NAME_CONTENT_EDITABLE)) {
// (contenteditable (EMPTY|TRUE|FALSE|INHERIT) TRUE)
atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
@@ -189,9 +201,16 @@ public class HTML5AttributeCollection extends AttributeCollection implements HTM
atype = new HTMLCMDataTypeImpl(CMDataType.NUMBER);
attr = new HTMLAttrDeclImpl(ATTR_NAME_HIGH, atype, CMAttributeDeclaration.OPTIONAL);
}
- else if (attrName.equalsIgnoreCase(ATTR_NAME_OPTIMUM)) {
- atype = new HTMLCMDataTypeImpl(CMDataType.NUMBER);
- attr = new HTMLAttrDeclImpl(ATTR_NAME_OPTIMUM, atype, CMAttributeDeclaration.OPTIONAL);
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_INPUTMODE)) {
+ atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {ATTR_VALUE_NONE, ATTR_VALUE_TEXT, ATTR_VALUE_DECIMAL, ATTR_VALUE_NUMERIC, ATTR_VALUE_TEL, ATTR_VALUE_SEARCH, ATTR_VALUE_EMAIL, ATTR_VALUE_URL};
+ atype.setEnumValues(values);
+ atype.setImpliedValue(CMDataType.IMPLIED_VALUE_DEFAULT, ATTR_VALUE_TEXT);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_INPUTMODE, atype, CMAttributeDeclaration.OPTIONAL);
+ }
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_IS)) {
+ atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_IS, atype, CMAttributeDeclaration.OPTIONAL);
}
else if (attrName.equalsIgnoreCase(ATTR_NAME_MIN)) {
atype = new HTMLCMDataTypeImpl(CMDataType.NUMBER);
@@ -206,6 +225,10 @@ public class HTML5AttributeCollection extends AttributeCollection implements HTM
atype.setEnumValues(new String[] { ATTR_NAME_OPEN });
attr = new HTMLAttrDeclImpl(ATTR_NAME_OPEN, atype, CMAttributeDeclaration.OPTIONAL);
}
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_OPTIMUM)) {
+ atype = new HTMLCMDataTypeImpl(CMDataType.NUMBER);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_OPTIMUM, atype, CMAttributeDeclaration.OPTIONAL);
+ }
else if (attrName.equalsIgnoreCase(ATTR_NAME_PUBDATE)) {
atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
atype.setEnumValues(new String[] { ATTR_NAME_PUBDATE });
@@ -216,6 +239,11 @@ public class HTML5AttributeCollection extends AttributeCollection implements HTM
atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
attr = new HTMLAttrDeclImpl(ATTR_NAME_ROLE, atype, CMAttributeDeclaration.OPTIONAL);
}
+ else if (attrName.equalsIgnoreCase(ATTR_NAME_SLOT)) {
+ // (span NUMBER 1)
+ atype = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ attr = new HTMLAttrDeclImpl(ATTR_NAME_SLOT, atype, CMAttributeDeclaration.OPTIONAL);
+ }
else if (attrName.equalsIgnoreCase(ATTR_NAME_SPELLCHECK)) {
// (spellcheck (EMPTY|TRUE|FALSE) TRUE)
atype = new HTMLCMDataTypeImpl(CMDataType.ENUM);
@@ -561,7 +589,7 @@ public class HTML5AttributeCollection extends AttributeCollection implements HTM
}
public void getCore(CMNamedNodeMapImpl declarations) {
- Iterator names = Arrays.asList(CORE).iterator();
+ Iterator<String> names = Arrays.asList(CORE).iterator();
getDeclarations(declarations, names);
}
diff --git a/web/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contentmodel/HTML5ElementCollection.java b/web/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contentmodel/HTML5ElementCollection.java
index 65e6cb362..d3af7a0c7 100644
--- a/web/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contentmodel/HTML5ElementCollection.java
+++ b/web/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contentmodel/HTML5ElementCollection.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
+ * Copyright (c) 2010, 2019 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -60,6 +60,7 @@ class HTML5ElementCollection extends ElementCollection implements org.eclipse.ws
public static final int ID_SVG =131;
public static final int ID_TIME =132;
public static final int ID_VIDEO =133;
+ public static final int ID_MAIN =134;
// D205513
@@ -111,7 +112,7 @@ class HTML5ElementCollection extends ElementCollection implements org.eclipse.ws
/** %preformatted;. PRE */
private static final String[] PREFORMATTED = {PRE};
/** %sectioning;. ARTICLE | ASIDE | NAV | SECTION */
- private static final String[] SECTIONING = { ARTICLE, ASIDE, NAV, SECTION };
+ private static final String[] SECTIONING = { ARTICLE, ASIDE, NAV, SECTION, MAIN };
/** %embedded;. AUDIO|CANVAS|EMBED|IFRAME|IMG|MATH|OBJECT|SVG|VIDEO */
private static final String[] EMBEDDED = { AUDIO, CANVAS, EMBED, IFRAME, IMG, MATH, OBJECT, SVG, VIDEO};
@@ -219,6 +220,9 @@ class HTML5ElementCollection extends ElementCollection implements org.eclipse.ws
edec = new HedKEYGEN(this);
}
+ else if (elementName.equalsIgnoreCase(MAIN)) {
+ edec = new HedSectioning(HTML50Namespace.ElementName.MAIN,this);
+ }
else if (elementName.equalsIgnoreCase(MARK)) {
edec = new HedPhrase(HTML50Namespace.ElementName.MARK,this);
@@ -508,6 +512,7 @@ class HTML5ElementCollection extends ElementCollection implements org.eclipse.ws
fNames[Ids.ID_LI] = LI;
fNames[Ids.ID_LINK] = LINK;
fNames[Ids.ID_MAP] = MAP;
+ fNames[Ids50.ID_MAIN] = MAIN;
fNames[Ids50.ID_MARK] = MARK;
fNames[Ids.ID_MARQUEE] = MARQUEE;
fNames[Ids50.ID_MATH] = MATH;
diff --git a/web/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/provisional/HTML50Namespace.java b/web/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/provisional/HTML50Namespace.java
index b04104650..d8cbdc732 100644
--- a/web/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/provisional/HTML50Namespace.java
+++ b/web/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/provisional/HTML50Namespace.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2017 IBM Corporation and others.
+ * Copyright (c) 2010, 2019 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -28,6 +28,7 @@ public interface HTML50Namespace extends HTML40Namespace {
String HEADER = "header";
String HGROUP = "hgroup";
String KEYGEN = "keygen";
+ String MAIN = "main";
String MARK = "mark";
String MATH = "math";
String METER = "meter";
@@ -49,11 +50,15 @@ public interface HTML50Namespace extends HTML40Namespace {
String HTML50_TAG_PREFIX = "";
// global attribute names
+ String ATTR_NAME_AUTOCAPITALIZE = "autocapitalize"; // %coreattrs; //$NON-NLS-1$
String ATTR_NAME_CONTENT_EDITABLE = "contenteditable"; // %coreattrs; //$NON-NLS-1$
String ATTR_NAME_CONTEXT_MENU = "contextmenu"; // %coreattrs; //$NON-NLS-1$
String ATTR_NAME_DRAGGABLE = "draggable"; // %coreattrs; //$NON-NLS-1$
String ATTR_NAME_DROPZONE = "dropzone"; // %coreattrs; //$NON-NLS-1$
+ String ATTR_NAME_INPUTMODE = "inputmode"; //$NON-NLS-1$
+ String ATTR_NAME_IS = "is"; //$NON-NLS-1$
String ATTR_NAME_ROLE = "role"; // %coreattrs; //$NON_NLS-1$
+ String ATTR_NAME_SLOT = "slot"; //$NON-NLS-1$
String ATTR_NAME_SPELLCHECK = "spellcheck"; // %coreattrs; //$NON-NLS-1$
String ATTR_NAME_TRANSLATE = "translate"; // %coreattrs; //$NON-NLS-1$
@@ -189,9 +194,17 @@ public interface HTML50Namespace extends HTML40Namespace {
String ATTR_VALUE_COLOR = "color"; //input type //$NON-NLS-1$
String ATTR_VALUE_NUMBER_STRING = "number"; //input type //$NON-NLS-1$
+ //Input modes
+ String ATTR_VALUE_DECIMAL = "decimal"; //input type //$NON-NLS-1$
+ String ATTR_VALUE_NUMERIC = "numeric"; //input type //$NON-NLS-1$
+
String ATTR_VALUE_ON = "on"; //input autocomplete //$NON-NLS-1$
String ATTR_VALUE_OFF = "off"; //input autocomplete //$NON-NLS-1$
+ String ATTR_VALUE_CHARACTERS = "characters"; //global attr autocapitalize //$NON-NLS-1$
+ String ATTR_VALUE_SENTENCES = "sentences"; //global attr autocapitalize //$NON-NLS-1$
+ String ATTR_VALUE_WORDS = "words"; //global attr autocapitalize //$NON-NLS-1$
+
String ATTR_VALUE_PUT = "PUT"; //input formmethod //$NON-NLS-1$
String ATTR_VALUE_DELETE = "DELETE"; //input formmethod //$NON-NLS-1$
diff --git a/web/tests/org.eclipse.wst.html.core.tests/META-INF/MANIFEST.MF b/web/tests/org.eclipse.wst.html.core.tests/META-INF/MANIFEST.MF
index eff46024c..2f2adb945 100644
--- a/web/tests/org.eclipse.wst.html.core.tests/META-INF/MANIFEST.MF
+++ b/web/tests/org.eclipse.wst.html.core.tests/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name.0
Bundle-SymbolicName: org.eclipse.wst.html.core.tests;singleton:=true
-Bundle-Version: 1.1.0.qualifier
+Bundle-Version: 1.1.100.qualifier
Bundle-Activator: org.eclipse.wst.html.core.tests.HTMLCoreTestsPlugin
Bundle-Vendor: %Bundle-Vendor.0
Bundle-Localization: plugin
diff --git a/web/tests/org.eclipse.wst.html.core.tests/pom.xml b/web/tests/org.eclipse.wst.html.core.tests/pom.xml
index 5d084303b..61dbac7f3 100644
--- a/web/tests/org.eclipse.wst.html.core.tests/pom.xml
+++ b/web/tests/org.eclipse.wst.html.core.tests/pom.xml
@@ -21,7 +21,7 @@
<groupId>org.eclipse.webtools.sourceediting</groupId>
<artifactId>org.eclipse.wst.html.core.tests</artifactId>
- <version>1.1.0-SNAPSHOT</version>
+ <version>1.1.100-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<properties>
diff --git a/web/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/html5/model/HTML5ContentModelTest.java b/web/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/html5/model/HTML5ContentModelTest.java
index 82b4bdfec..6a21a178e 100644
--- a/web/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/html5/model/HTML5ContentModelTest.java
+++ b/web/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/html5/model/HTML5ContentModelTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2017 IBM Corporation and others.
+ * Copyright (c) 2010, 2019 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -43,8 +43,8 @@ public class HTML5ContentModelTest extends TestCase {
private void checkAttrNames(String documentKey, String elementName, String[] attrNames) {
CMDocument document = HTMLCMDocumentFactory.getCMDocument(documentKey);
CMNode elementDeclaration = document.getElements().getNamedItem(elementName);
+ assertNotNull("no such element declaration:" + elementName, elementDeclaration);
assertEquals("not an element declaration:" + elementDeclaration, CMNode.ELEMENT_DECLARATION, elementDeclaration.getNodeType());
- assertNotNull("missing element declaration:" + elementName, elementDeclaration);
CMNamedNodeMap attributes = ((CMElementDeclaration) elementDeclaration).getAttributes();
@@ -162,6 +162,10 @@ public class HTML5ContentModelTest extends TestCase {
}
+ public void testAttributesOnHTML5Main() {
+ checkAttrNames(CMDocType.HTML5_DOC_TYPE, HTML50Namespace.ElementName.MAIN, getGlobalList());
+ }
+
public void testAttributesOnHTML5Mark() {
checkAttrNames(CMDocType.HTML5_DOC_TYPE, HTML50Namespace.ElementName.MARK, getGlobalList());
}

Back to the top