Skip to content

Instantly share code, notes, and snippets.

@bobsilverberg
Forked from jarib/Gemfile
Created May 3, 2012 13:01
Show Gist options
  • Save bobsilverberg/2585461 to your computer and use it in GitHub Desktop.
Save bobsilverberg/2585461 to your computer and use it in GitHub Desktop.
Boolean attributes by tag name
{
"a": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"abbr": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"address": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"area": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"noHref",
"spellcheck",
"translate"
],
"article": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"aside": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"audio": [
"autoplay",
"commandChecked",
"commandDisabled",
"commandHidden",
"controls",
"defaultMuted",
"draggable",
"ended",
"hidden",
"isContentEditable",
"itemScope",
"loop",
"muted",
"paused",
"seeking",
"spellcheck",
"translate"
],
"b": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"base": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"bdi": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"bdo": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"blockquote": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"body": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"br": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"button": [
"autofocus",
"commandChecked",
"commandDisabled",
"commandHidden",
"disabled",
"draggable",
"formNoValidate",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate",
"willValidate"
],
"canvas": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"caption": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"cite": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"code": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"col": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"colgroup": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"command": [
"checked",
"commandChecked",
"commandDisabled",
"commandHidden",
"disabled",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"data": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"datalist": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"dd": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"del": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"details": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"open",
"spellcheck",
"translate"
],
"dfn": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"dialog": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"open",
"spellcheck",
"translate"
],
"div": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"dl": [
"commandChecked",
"commandDisabled",
"commandHidden",
"compact",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"dt": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"em": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"embed": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"fieldset": [
"commandChecked",
"commandDisabled",
"commandHidden",
"disabled",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate",
"willValidate"
],
"figcaption": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"figure": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"footer": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"form": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"noValidate",
"spellcheck",
"translate"
],
"h1": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"h2": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"h3": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"h4": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"h5": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"h6": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"head": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"header": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"hgroup": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"hr": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"noShade",
"spellcheck",
"translate"
],
"html": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"i": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"iframe": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"seamless",
"spellcheck",
"translate"
],
"img": [
"commandChecked",
"commandDisabled",
"commandHidden",
"complete",
"draggable",
"hidden",
"isContentEditable",
"isMap",
"itemScope",
"spellcheck",
"translate"
],
"input": [
"autofocus",
"checked",
"commandChecked",
"commandDisabled",
"commandHidden",
"defaultChecked",
"disabled",
"draggable",
"formNoValidate",
"hidden",
"indeterminate",
"isContentEditable",
"itemScope",
"multiple",
"readOnly",
"required",
"spellcheck",
"translate",
"willValidate"
],
"ins": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"kbd": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"keygen": [
"autofocus",
"commandChecked",
"commandDisabled",
"commandHidden",
"disabled",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate",
"willValidate"
],
"label": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"legend": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"li": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"link": [
"commandChecked",
"commandDisabled",
"commandHidden",
"disabled",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"map": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"mark": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"menu": [
"commandChecked",
"commandDisabled",
"commandHidden",
"compact",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"meta": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"meter": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"nav": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"noscript": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"object": [
"commandChecked",
"commandDisabled",
"commandHidden",
"declare",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate",
"typeMustMatch",
"willValidate"
],
"ol": [
"commandChecked",
"commandDisabled",
"commandHidden",
"compact",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"reversed",
"spellcheck",
"translate"
],
"optgroup": [
"commandChecked",
"commandDisabled",
"commandHidden",
"disabled",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"option": [
"commandChecked",
"commandDisabled",
"commandHidden",
"defaultSelected",
"disabled",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"selected",
"spellcheck",
"translate"
],
"output": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate",
"willValidate"
],
"p": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"param": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"pre": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"progress": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"q": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"rp": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"rt": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"ruby": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"s": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"samp": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"script": [
"async",
"commandChecked",
"commandDisabled",
"commandHidden",
"defer",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"section": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"select": [
"autofocus",
"commandChecked",
"commandDisabled",
"commandHidden",
"disabled",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"multiple",
"required",
"spellcheck",
"translate",
"willValidate"
],
"small": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"source": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"span": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"strong": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"style": [
"commandChecked",
"commandDisabled",
"commandHidden",
"disabled",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"scoped",
"spellcheck",
"translate"
],
"sub": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"summary": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"sup": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"table": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"tbody": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"td": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"noWrap",
"spellcheck",
"translate"
],
"textarea": [
"autofocus",
"commandChecked",
"commandDisabled",
"commandHidden",
"disabled",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"readOnly",
"required",
"spellcheck",
"translate",
"willValidate"
],
"tfoot": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"th": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"noWrap",
"spellcheck",
"translate"
],
"thead": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"time": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"title": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"tr": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"track": [
"commandChecked",
"commandDisabled",
"commandHidden",
"default",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"u": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"ul": [
"commandChecked",
"commandDisabled",
"commandHidden",
"compact",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"var": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"video": [
"autoplay",
"commandChecked",
"commandDisabled",
"commandHidden",
"controls",
"defaultMuted",
"draggable",
"ended",
"hidden",
"isContentEditable",
"itemScope",
"loop",
"muted",
"paused",
"seeking",
"spellcheck",
"translate"
],
"wbr": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
],
"frameset": [
"commandChecked",
"commandDisabled",
"commandHidden",
"draggable",
"hidden",
"isContentEditable",
"itemScope",
"spellcheck",
"translate"
]
}
require 'watir-webdriver/html'
require 'json'
class BooleanAttributeFinder
IGNORED_ELEMENTS = [
"Element" # not defined by HTML
]
def initialize(spec_url)
@extractor = Watir::HTML::SpecExtractor.new(spec_url)
@tag_to_interfaces = @extractor.process
end
def result
map = Hash.new { |hash, key| hash[key] = [] }
@tag_to_interfaces.each do |tag, interfaces|
interfaces.each do |interface|
map[tag] += boolean_attributes_for(interface)
end
end
result = {}
map.each do |tag, attrs|
result[tag] = attrs.uniq.sort
end
result
end
def boolean_attributes_for(interface)
result = interface.members.select { |e| e.kind_of?(WebIDL::Ast::Attribute) && e.type.name == :Boolean }.map { |e| e.name }
if interface.inherits
interface.inherits.each do |scoped_name|
# Element is not defined in the HTML spec
next if IGNORED_ELEMENTS.include?(scoped_name.name)
parents = @extractor.fetch_interface(scoped_name.name)
parents.flatten.each do |parent|
result += boolean_attributes_for(parent)
end
end
end
result
end
end
baf = BooleanAttributeFinder.new(ENV['SPEC_PATH'] || "http://www.whatwg.org/specs/web-apps/current-work/")
puts JSON.pretty_generate(baf.result)
source :rubygems
gem "webidl"
gem "nokogiri"
gem "activesupport"
gem "watir-webdriver", :git => "git://github.com/watir/watir-webdriver"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment