diff options
author | Nitin Dahyabhai | 2017-05-01 20:43:33 +0000 |
---|---|---|
committer | Nitin Dahyabhai | 2017-05-01 20:43:33 +0000 |
commit | 0138c694d96d7fc9d5bfab9e308eba0d4373f6b4 (patch) | |
tree | 34840ced35e918b21f1593b2b6e8207905339e89 | |
parent | fc2986ae2ca39dd33c97b07cecc237094fde0c32 (diff) | |
download | webtools.sourceediting-0138c694d96d7fc9d5bfab9e308eba0d4373f6b4.tar.gz webtools.sourceediting-0138c694d96d7fc9d5bfab9e308eba0d4373f6b4.tar.xz webtools.sourceediting-0138c694d96d7fc9d5bfab9e308eba0d4373f6b4.zip |
[500348] The 'type' attribute is now valid in HTML5 by its
specification, but still marked as obsolete.
2 files changed, 87 insertions, 10 deletions
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contentmodel/HTML5AttributeCollection.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contentmodel/HTML5AttributeCollection.java index 00cd7d1705..4da030847b 100644 --- a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contentmodel/HTML5AttributeCollection.java +++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contentmodel/HTML5AttributeCollection.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 IBM Corporation and others. + * Copyright (c) 2010, 2017 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 @@ -635,11 +635,12 @@ public class HTML5AttributeCollection extends AttributeCollection implements HTM attributes.putNamedItem(ATTR_NAME_ALT, attr); - // (type %autocomeplete; ) ... should be defined locally. - // NOTE: %autocomeplete is ENUM; + // (type %autocomplete; ) ... should be defined locally. + // NOTE: %autocomplete is ENUM, but which enums can differ; + // http://w3c.github.io/html/sec-forms.html#autofilling-form-controls-the-autocomplete-attribute // (on | off) - atype = new HTMLCMDataTypeImpl(CMDataType.ENUM); - String[] autoCompleteValues = {ATTR_VALUE_ON, ATTR_VALUE_OFF}; + atype = new HTMLCMDataTypeImpl(CMDataType.CDATA); + String[] autoCompleteValues = ATTR_AUTOFILL_DETAIL_TOKENS; atype.setEnumValues(autoCompleteValues); attr = new HTMLAttrDeclImpl(ATTR_NAME_AUTOCOMPLETE, atype, CMAttributeDeclaration.OPTIONAL); attributes.putNamedItem(ATTR_NAME_AUTOCOMPLETE, attr); @@ -1032,6 +1033,18 @@ public class HTML5AttributeCollection extends AttributeCollection implements HTM atype.setEnumValues(requiredValues); attr = new HTMLAttrDeclImpl(ATTR_NAME_REQUIRED, atype, CMAttributeDeclaration.OPTIONAL); attributes.putNamedItem(ATTR_NAME_REQUIRED, attr); + + // (type %autocomplete; ) ... should be defined locally. + // NOTE: %autocomplete is ENUM, but which enums can differ; + // http://w3c.github.io/html/sec-forms.html#autofilling-form-controls-the-autocomplete-attribute + // (on | off) + atype = new HTMLCMDataTypeImpl(CMDataType.ENUM); + String[] autoCompleteValues = new String[ATTR_AUTOFILL_DETAIL_TOKENS.length + ATTR_AUTOFILL_MULTILINE_DETAIL_TOKENS.length]; + System.arraycopy(ATTR_AUTOFILL_DETAIL_TOKENS, 0, autoCompleteValues, 0, ATTR_AUTOFILL_DETAIL_TOKENS.length); + System.arraycopy(ATTR_AUTOFILL_MULTILINE_DETAIL_TOKENS, 0, autoCompleteValues, ATTR_AUTOFILL_DETAIL_TOKENS.length, ATTR_AUTOFILL_MULTILINE_DETAIL_TOKENS.length); + atype.setEnumValues(autoCompleteValues); + attr = new HTMLAttrDeclImpl(ATTR_NAME_AUTOCOMPLETE, atype, CMAttributeDeclaration.OPTIONAL); + attributes.putNamedItem(ATTR_NAME_AUTOCOMPLETE, attr); } /* * (charset %Charset; #IMPLIED) @@ -1170,11 +1183,10 @@ public class HTML5AttributeCollection extends AttributeCollection implements HTM HTMLAttrDeclImpl attr = new HTMLAttrDeclImpl(ATTR_NAME_REVERSED, atype, CMAttributeDeclaration.OPTIONAL); attributes.putNamedItem(ATTR_NAME_REVERSED, attr); - //discouraged - // (type %OLStyle; #IMPLIED) ... should be defined locally. - atype = new HTMLCMDataTypeImpl(HTMLCMDataType.OL_STYLE); + // (type ENUM #IMPLIED) + atype = new HTMLCMDataTypeImpl(CMDataType.ENUM); + atype.setEnumValues(new String[] {"1", "A", "a", "I", "i"}); attr = new HTMLAttrDeclImpl(ATTR_NAME_TYPE, atype, CMAttributeDeclaration.OPTIONAL); - attr.obsolete(true); attributes.putNamedItem(ATTR_NAME_TYPE, attr); // (compact (compact) #IMPLIED) diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/provisional/HTML50Namespace.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/provisional/HTML50Namespace.java index 59b2764d14..0f48d426ce 100644 --- a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/provisional/HTML50Namespace.java +++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/provisional/HTML50Namespace.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 IBM Corporation and others. + * Copyright (c) 2010, 2017 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 @@ -202,5 +202,70 @@ public interface HTML50Namespace extends HTML40Namespace { String ATTR_VALUE_CONTEXT = "context"; //menu type //$NON-NLS-1$ String ATTR_VALUE_TOOLBAR = "toolbar"; //menu type //$NON-NLS-1$ String ATTR_VALUE_LIST = "list"; //menu type //$NON-NLS-1$ + + // http://w3c.github.io/html/sec-forms.html#autofilling-form-controls-the-autocomplete-attribute + String[] ATTR_AUTOFILL_MULTILINE_DETAIL_TOKENS = new String[] { "street-address" }; + String[] ATTR_AUTOFILL_DETAIL_TOKENS = new String[] { + "name", + "honorific-prefix", + "given-name", + "additional-name", + "family-name", + "honorific-suffix", + "nickname", + "username", + "new-password", + "current-password", + "organization-title", + "organization", + "address-line1", + "address-line2", + "address-line3", + "address-level4", + "address-level3", + "address-level2", + "address-level1", + "country", + "country-name", + "postal-code", + "cc-name", + "cc-given-name", + "cc-additional-name", + "cc-family-name", + "cc-number", + "cc-exp", + "cc-exp-month", + "cc-exp-year", + "cc-csc", + "cc-type", + "transaction-currency", + "transaction-amount", + "language", + "bday", + "bday-day", + "bday-month", + "bday-year", + "sex", + "url", + "photo", + "shipping", + "billing", + "home", + "work", + "mobile", + "fax", + "pager", + "tel", + "tel-country-code", + "tel-national", + "tel-area-code", + "tel-local", + "tel-local-prefix", + "tel-local-suffix", + "tel-extension", + "email", + "impp", + "on", + "off"}; } |