r13725 dsilvers - /trunk/libdom/src/core/element.c

netsurf at semichrome.net netsurf at semichrome.net
Mon Mar 26 19:08:18 BST 2012


Author: dsilvers
Date: Mon Mar 26 13:08:18 2012
New Revision: 13725

URL: http://source.netsurf-browser.org?rev=13725&view=rev
Log:
Minor improvement by short-circuiting for no classes in _dom_element_has_class

Modified:
    trunk/libdom/src/core/element.c

Modified: trunk/libdom/src/core/element.c
URL: http://source.netsurf-browser.org/trunk/libdom/src/core/element.c?rev=13725&r1=13724&r2=13725&view=diff
==============================================================================
--- trunk/libdom/src/core/element.c (original)
+++ trunk/libdom/src/core/element.c Mon Mar 26 13:08:18 2012
@@ -1192,10 +1192,13 @@
 	dom_exception err;
 	unsigned int class;
 	struct dom_node_internal *node = (struct dom_node_internal *)element;
-	dom_document_quirks_mode quirks_mode =
-			DOM_DOCUMENT_QUIRKS_MODE_NONE;
-
-	*match = false;
+	dom_document_quirks_mode quirks_mode;
+	
+	/* Short-circuit case where we have no classes */
+	if (element->n_classes == 0) {
+		*match = false;
+		return DOM_NO_ERR;
+	}
 
 	err = dom_document_get_quirks_mode(node->owner, &quirks_mode);
 	if (err != DOM_NO_ERR)




More information about the netsurf-commits mailing list