diff options
author | Urban Müller | 2009-08-20 12:38:08 +0000 |
---|---|---|
committer | Urban Müller | 2009-08-20 12:38:08 +0000 |
commit | 9f92541c0dd856f8ffe6e956ebe76bff33eade0f (patch) | |
tree | 5542f90e40e036e258ba536f10a4783bf5e23879 | |
parent | 685d9970cc58adc93500058215ae6c9337790a59 (diff) | |
download | itools-9f92541c0dd856f8ffe6e956ebe76bff33eade0f.tar.gz itools-9f92541c0dd856f8ffe6e956ebe76bff33eade0f.tar.bz2 itools-9f92541c0dd856f8ffe6e956ebe76bff33eade0f.zip |
enforce img alt
-rw-r--r-- | it_html.class | 6 | ||||
-rwxr-xr-x | tests/it_html.t | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/it_html.class b/it_html.class index 9216615..db66abb 100644 --- a/it_html.class +++ b/it_html.class @@ -316,6 +316,12 @@ function img($args) } } + foreach ($args as $arg) + $havealt += isset($arg['alt']); + + if (!$havealt) + it::error('img() needs alt'); + return $this->_tag("img", $args); } diff --git a/tests/it_html.t b/tests/it_html.t index 75a8c69..8a8aed6 100755 --- a/tests/it_html.t +++ b/tests/it_html.t @@ -19,8 +19,8 @@ is( ); is( - img(array('src' => "foo.png")), - '<img src="foo.png">', + img(array('src' => "foo.png", 'alt' => "")), + '<img src="foo.png" alt="">', "empty link tag" ); |