private static boolean isAttributeBinding(Attribute attribute) { String attributeName = attribute.getKey().toLowerCase(); return attributeName.startsWith(":") || attributeName.startsWith("v-bind:"); }
private static boolean isEventBinding(Attribute attribute) { String attributeName = attribute.getKey().toLowerCase(); return attributeName.startsWith("@") || attributeName.startsWith("v-on:"); }
/** * Returns the {@link Attribute} with the specified name (case insensitive). * <p> * If more than one attribute exists with the specified name (which is illegal HTML), * the first is returned. * * @param name the name of the attribute to get. * @return the attribute with the specified name, or <code>null</code> if no attribute with the specified name exists. * @see #getValue(String name) */ public Attribute get(final String name) { final int size=attributeList.size(); for (int i=0; i<size; i++) { final Attribute attribute=attributeList.get(i); if (attribute.getKey().equalsIgnoreCase(name)) return attribute; } return null; }
/** * Guess the type of the expression based on where it is used. The guessed type can be overridden * by adding a Cast to the desired type at the beginning of the expression. * * @param attribute The attribute the expression is in */ private TypeName getExpressionReturnTypeForAttribute(Attribute attribute, Map<String, Class<?>> propertiesTypes) { String attributeName = attribute.getKey().toLowerCase(); if (attributeName.indexOf("@") == 0 || attributeName.indexOf("v-on:") == 0) { return TypeName.VOID; } if ("v-if".equals(attributeName) || "v-show".equals(attributeName)) { return TypeName.BOOLEAN; } if (isBoundedAttribute(attributeName)) { String unboundedAttributeName = boundedAttributeToAttributeName(attributeName); if (unboundedAttributeName.equals("class") || unboundedAttributeName.equals("style")) { return TypeName.get(Any.class); } if (propertiesTypes.containsKey(unboundedAttributeName)) { return TypeName.get(propertiesTypes.get(unboundedAttributeName)); } } if (currentProp != null) { return currentProp.getType(); } return TypeName.get(Any.class); }
AttributeIncludeChecker attributeIncludeChecker=map.get(attribute.getKey()); if (attributeIncludeChecker==null) return false; return attributeIncludeChecker.includeAttribute(startTag,attribute);
/** * Populates the specified <code>Map</code> with the name/value pairs from these attributes. * <p> * Both names and values are stored as <code>String</code> objects. * <p> * The entries are added in order of apprearance in the source document. * <p> * An attribute with {@linkplain Attribute#hasValue() no value} is represented by a map entry with a <code>null</code> value. * <p> * Attribute values are automatically {@linkplain CharacterReference#decode(CharSequence) decoded} * before storage in the map. * * @param attributesMap the map to populate, must not be <code>null</code>. * @param convertNamesToLowerCase specifies whether all attribute names are converted to lower case in the map. * @return the same map specified as the argument to the <code>attributesMap</code> parameter, populated with the name/value pairs from these attributes. * @see #generateHTML(Map attributesMap) */ public Map<String,String> populateMap(final Map<String,String> attributesMap, final boolean convertNamesToLowerCase) { for (Attribute attribute : this) { attributesMap.put(convertNamesToLowerCase ? attribute.getKey() : attribute.getName(),attribute.getValue()); } return attributesMap; }
private static String findOpenGraphNamespacePrefix(Element htmlTag) { String prefix = OpenGraphVocabulary.DEFAULT_PREFIX; if (htmlTag != null) { Attributes attributes = htmlTag.getAttributes(); int attributeCount = attributes.size(); for (int i = 0; i < attributeCount; i++) { Attribute attr = attributes.get(i); String value = attr.getValue(); String key = attr.getKey().toLowerCase().trim(); if (key.startsWith(XMLNS_PREFIX)) { if (value.equals(OpenGraphVocabulary.NAMESPACE)) { prefix = key.substring(XMLNS_PREFIX.length()); } } } } return prefix; }
private CharSequence getStartTagHTML(StartTag startTag) { // tidies and filters out non-approved attributes StringBuilder sb = new StringBuilder(); sb.append('<').append(startTag.getName()); for (Attribute attribute : startTag.getAttributes()) { if (allowedAttributes.contains(attribute.getKey().toLowerCase())) { sb.append(' ').append(attribute.getName()); if (attribute.getValue() != null) { sb.append("=\""); sb.append(CharacterReference.encode(attribute.getValue())); sb.append('"'); } } } if (startTag.getElement().getEndTag() == null && !HTMLElements.getEndTagOptionalElementNames().contains(startTag.getName())) { sb.append(" /"); } sb.append('>'); return sb; }
envAttributes.put(att.getKey(), att.getValue());
String key = attribute.getKey(); if ("v-for".equals(key) || "slot-scope".equals(key)) { continue;