From f0fb4a3928971fb885f87bb5f25bb5a5c064e927 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Sun, 30 Jan 2011 14:43:53 -0800 Subject: jqlite should not generate exceptions when accessing attributes on Document --- src/jqLite.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/jqLite.js b/src/jqLite.js index a59ba6c2..b607c095 100644 --- a/src/jqLite.js +++ b/src/jqLite.js @@ -206,8 +206,9 @@ JQLite.prototype = { } else if (isDefined(value)) { e.setAttribute(name, value); } else { - // the extra argument is to get the right thing for a.href in IE, see jQuery code - return e.getAttribute(name, 2); + // the extra argument "2" is to get the right thing for a.href in IE, see jQuery code + // some elements (e.g. Document) don't have get attribute, so return undefined + if (e.getAttribute) return e.getAttribute(name, 2); } }, -- cgit v1.2.3