/** * This override will render <code>multiple</code>, <code>directory</code> and <code>accept</code> attributes * accordingly. As the <code>directory</code> attribute is relatively new, for better browser compatibility the * <code>webkitdirectory</code> attribute will also be written along it. * <p> * They're written as passthrough attributes because in Mojarra the <code>startElement()</code> takes place in * {@link #encodeEnd(FacesContext)} instead of {@link #encodeBegin(FacesContext)}. */ @Override public void encodeEnd(FacesContext context) throws IOException { Map<String, Object> passThroughAttributes = getPassThroughAttributes(); if (isMultiple()) { passThroughAttributes.put("multiple", true); // http://caniuse.com/#feat=input-file-multiple } if (isDirectory()) { passThroughAttributes.put("directory", true); // Firefox 46+ (Firefox 42-45 requires enabling via about:config). passThroughAttributes.put("webkitdirectory", true); // Chrome 11+, Safari 4+ and Edge. } String accept = getAccept(); if (accept != null) { passThroughAttributes.put("accept", accept); // http://caniuse.com/#feat=input-file-accept } Long maxsize = getMaxsize(); if (maxsize != null) { validateHierarchy(); setOnchange(format(SCRIPT_ONCHANGE, getMessageComponentClientId(), maxsize, coalesce(getOnchange(), ""))); } super.encodeEnd(context); }
/** * This override will render <code>multiple</code>, <code>directory</code> and <code>accept</code> attributes * accordingly. As the <code>directory</code> attribute is relatively new, for better browser compatibility the * <code>webkitdirectory</code> attribute will also be written along it. * <p> * They're written as passthrough attributes because in Mojarra the <code>startElement()</code> takes place in * {@link #encodeEnd(FacesContext)} instead of {@link #encodeBegin(FacesContext)}. */ @Override public void encodeEnd(FacesContext context) throws IOException { Map<String, Object> passThroughAttributes = getPassThroughAttributes(); if (isMultiple()) { passThroughAttributes.put("multiple", true); // http://caniuse.com/#feat=input-file-multiple } if (isDirectory()) { passThroughAttributes.put("directory", true); // Firefox 46+ (Firefox 42-45 requires enabling via about:config). passThroughAttributes.put("webkitdirectory", true); // Chrome 11+, Safari 4+ and Edge. } String accept = getAccept(); if (accept != null) { passThroughAttributes.put("accept", accept); // http://caniuse.com/#feat=input-file-accept } Long maxsize = getMaxsize(); if (maxsize != null) { validateHierarchy(); setOnchange(format(SCRIPT_ONCHANGE, getMessageComponentClientId(), maxsize, coalesce(getOnchange(), ""))); } super.encodeEnd(context); }