diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 8b40fea72a6..58f662a75c8 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -506,7 +506,6 @@ void NSContainer_Release(NSContainer*);
void init_mutation(NSContainer*);
void set_mutation_observer(NSContainer*,nsIDOMHTMLDocument*);
-BOOL handle_insert_comment(HTMLDocument *doc, const PRUnichar *comment);
void HTMLDocument_LockContainer(HTMLDocument*,BOOL);
void show_context_menu(HTMLDocument*,DWORD,POINT*,IDispatch*);
diff --git a/dlls/mshtml/mutation.c b/dlls/mshtml/mutation.c
index 171190829d3..edd3dca4178 100644
--- a/dlls/mshtml/mutation.c
+++ b/dlls/mshtml/mutation.c
@@ -55,6 +55,144 @@ void set_mutation_observer(NSContainer *nscontainer, nsIDOMHTMLDocument *nshtmld
nsIDOMNSDocument_Release(nsdoc);
}
+#define IE_MAJOR_VERSION 7
+#define IE_MINOR_VERSION 0
+
+static BOOL handle_insert_comment(HTMLDocument *doc, const PRUnichar *comment)
+{
+ DWORD len;
+ int majorv = 0, minorv = 0;
+ const PRUnichar *ptr, *end;
+ nsAString nsstr;
+ PRUnichar *buf;
+ nsresult nsres;
+
+ enum {
+ CMP_EQ,
+ CMP_LT,
+ CMP_LTE,
+ CMP_GT,
+ CMP_GTE
+ } cmpt = CMP_EQ;
+
+ static const PRUnichar endifW[] = {'<','!','[','e','n','d','i','f',']'};
+
+ if(comment[0] != '[' || comment[1] != 'i' || comment[2] != 'f')
+ return FALSE;
+
+ ptr = comment+3;
+ while(isspaceW(*ptr))
+ ptr++;
+
+ if(ptr[0] == 'l' && ptr[1] == 't') {
+ ptr += 2;
+ if(*ptr == 'e') {
+ cmpt = CMP_LTE;
+ ptr++;
+ }else {
+ cmpt = CMP_LT;
+ }
+ }else if(ptr[0] == 'g' && ptr[1] == 't') {
+ ptr += 2;
+ if(*ptr == 'e') {
+ cmpt = CMP_GTE;
+ ptr++;
+ }else {
+ cmpt = CMP_GT;
+ }
+ }
+
+ if(!isspaceW(*ptr++))
+ return FALSE;
+ while(isspaceW(*ptr))
+ ptr++;
+
+ if(ptr[0] != 'I' || ptr[1] != 'E')
+ return FALSE;
+
+ ptr +=2;
+ if(!isspaceW(*ptr++))
+ return FALSE;
+ while(isspaceW(*ptr))
+ ptr++;
+
+ if(!isdigitW(*ptr))
+ return FALSE;
+ while(isdigitW(*ptr))
+ majorv = majorv*10 + (*ptr++ - '0');
+
+ if(*ptr == '.') {
+ if(!isdigitW(*ptr))
+ return FALSE;
+ while(isdigitW(*ptr))
+ minorv = minorv*10 + (*ptr++ - '0');
+ }
+
+ while(isspaceW(*ptr))
+ ptr++;
+ if(ptr[0] != ']' || ptr[1] != '>')
+ return FALSE;
+ ptr += 2;
+
+ len = strlenW(ptr);
+ if(len < sizeof(endifW)/sizeof(WCHAR))
+ return FALSE;
+
+ end = ptr + len-sizeof(endifW)/sizeof(WCHAR);
+ if(memcmp(end, endifW, sizeof(endifW)))
+ return FALSE;
+
+ switch(cmpt) {
+ case CMP_EQ:
+ if(majorv == IE_MAJOR_VERSION && minorv == IE_MINOR_VERSION)
+ break;
+ return FALSE;
+ case CMP_LT:
+ if(majorv > IE_MAJOR_VERSION)
+ break;
+ if(majorv == IE_MAJOR_VERSION && minorv > IE_MINOR_VERSION)
+ break;
+ return FALSE;
+ case CMP_LTE:
+ if(majorv > IE_MAJOR_VERSION)
+ break;
+ if(majorv == IE_MAJOR_VERSION && minorv >= IE_MINOR_VERSION)
+ break;
+ return FALSE;
+ case CMP_GT:
+ if(majorv < IE_MAJOR_VERSION)
+ break;
+ if(majorv == IE_MAJOR_VERSION && minorv < IE_MINOR_VERSION)
+ break;
+ return FALSE;
+ case CMP_GTE:
+ if(majorv < IE_MAJOR_VERSION)
+ break;
+ if(majorv == IE_MAJOR_VERSION && minorv <= IE_MINOR_VERSION)
+ break;
+ return FALSE;
+ }
+
+ buf = heap_alloc((end-ptr+1)*sizeof(WCHAR));
+ if(!buf)
+ return FALSE;
+
+ memcpy(buf, ptr, (end-ptr)*sizeof(WCHAR));
+ buf[end-ptr] = 0;
+ nsAString_Init(&nsstr, buf);
+ heap_free(buf);
+
+ /* FIXME: Find better way to insert HTML to document. */
+ nsres = nsIDOMHTMLDocument_Write(doc->nsdoc, &nsstr);
+ nsAString_Finish(&nsstr);
+ if(NS_FAILED(nsres)) {
+ ERR("Write failed: %08x\n", nsres);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
static void add_script_runner(NSContainer *This)
{
nsIDOMNSDocument *nsdoc;
diff --git a/dlls/mshtml/nsevents.c b/dlls/mshtml/nsevents.c
index ac4572c5709..1933c5788cd 100644
--- a/dlls/mshtml/nsevents.c
+++ b/dlls/mshtml/nsevents.c
@@ -175,144 +175,6 @@ static nsresult NSAPI handle_load(nsIDOMEventListener *iface, nsIDOMEvent *event
return NS_OK;
}
-#define IE_MAJOR_VERSION 7
-#define IE_MINOR_VERSION 0
-
-BOOL handle_insert_comment(HTMLDocument *doc, const PRUnichar *comment)
-{
- DWORD len;
- int majorv = 0, minorv = 0;
- const PRUnichar *ptr, *end;
- nsAString nsstr;
- PRUnichar *buf;
- nsresult nsres;
-
- enum {
- CMP_EQ,
- CMP_LT,
- CMP_LTE,
- CMP_GT,
- CMP_GTE
- } cmpt = CMP_EQ;
-
- static const PRUnichar endifW[] = {'<','!','[','e','n','d','i','f',']'};
-
- if(comment[0] != '[' || comment[1] != 'i' || comment[2] != 'f')
- return FALSE;
-
- ptr = comment+3;
- while(isspaceW(*ptr))
- ptr++;
-
- if(ptr[0] == 'l' && ptr[1] == 't') {
- ptr += 2;
- if(*ptr == 'e') {
- cmpt = CMP_LTE;
- ptr++;
- }else {
- cmpt = CMP_LT;
- }
- }else if(ptr[0] == 'g' && ptr[1] == 't') {
- ptr += 2;
- if(*ptr == 'e') {
- cmpt = CMP_GTE;
- ptr++;
- }else {
- cmpt = CMP_GT;
- }
- }
-
- if(!isspaceW(*ptr++))
- return FALSE;
- while(isspaceW(*ptr))
- ptr++;
-
- if(ptr[0] != 'I' || ptr[1] != 'E')
- return FALSE;
-
- ptr +=2;
- if(!isspaceW(*ptr++))
- return FALSE;
- while(isspaceW(*ptr))
- ptr++;
-
- if(!isdigitW(*ptr))
- return FALSE;
- while(isdigitW(*ptr))
- majorv = majorv*10 + (*ptr++ - '0');
-
- if(*ptr == '.') {
- if(!isdigitW(*ptr))
- return FALSE;
- while(isdigitW(*ptr))
- minorv = minorv*10 + (*ptr++ - '0');
- }
-
- while(isspaceW(*ptr))
- ptr++;
- if(ptr[0] != ']' || ptr[1] != '>')
- return FALSE;
- ptr += 2;
-
- len = strlenW(ptr);
- if(len < sizeof(endifW)/sizeof(WCHAR))
- return FALSE;
-
- end = ptr + len-sizeof(endifW)/sizeof(WCHAR);
- if(memcmp(end, endifW, sizeof(endifW)))
- return FALSE;
-
- switch(cmpt) {
- case CMP_EQ:
- if(majorv == IE_MAJOR_VERSION && minorv == IE_MINOR_VERSION)
- break;
- return FALSE;
- case CMP_LT:
- if(majorv > IE_MAJOR_VERSION)
- break;
- if(majorv == IE_MAJOR_VERSION && minorv > IE_MINOR_VERSION)
- break;
- return FALSE;
- case CMP_LTE:
- if(majorv > IE_MAJOR_VERSION)
- break;
- if(majorv == IE_MAJOR_VERSION && minorv >= IE_MINOR_VERSION)
- break;
- return FALSE;
- case CMP_GT:
- if(majorv < IE_MAJOR_VERSION)
- break;
- if(majorv == IE_MAJOR_VERSION && minorv < IE_MINOR_VERSION)
- break;
- return FALSE;
- case CMP_GTE:
- if(majorv < IE_MAJOR_VERSION)
- break;
- if(majorv == IE_MAJOR_VERSION && minorv <= IE_MINOR_VERSION)
- break;
- return FALSE;
- }
-
- buf = heap_alloc((end-ptr+1)*sizeof(WCHAR));
- if(!buf)
- return FALSE;
-
- memcpy(buf, ptr, (end-ptr)*sizeof(WCHAR));
- buf[end-ptr] = 0;
- nsAString_Init(&nsstr, buf);
- heap_free(buf);
-
- /* FIXME: Find better way to insert HTML to document. */
- nsres = nsIDOMHTMLDocument_Write(doc->nsdoc, &nsstr);
- nsAString_Finish(&nsstr);
- if(NS_FAILED(nsres)) {
- ERR("Write failed: %08x\n", nsres);
- return FALSE;
- }
-
- return TRUE;
-}
-
static nsresult NSAPI handle_htmlevent(nsIDOMEventListener *iface, nsIDOMEvent *event)
{
NSContainer *This = NSEVENTLIST_THIS(iface)->This;