Commit 2e6598dc authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Expose IHTMLCSSStyleDeclaration interface to scripts.

parent d35e6fea
......@@ -9668,6 +9668,12 @@ static HRESULT HTMLStyle_get_dispid(DispatchEx *dispex, BSTR name, DWORD flags,
return DISP_E_UNKNOWNNAME;
}
void HTMLStyle_init_dispex_info(dispex_data_t *info, compat_mode_t mode)
{
if(mode >= COMPAT_MODE_IE9)
dispex_info_add_interface(info, IHTMLCSSStyleDeclaration_tid, NULL);
}
static const dispex_static_data_vtbl_t HTMLStyle_dispex_vtbl = {
NULL,
HTMLStyle_get_dispid,
......@@ -9687,7 +9693,8 @@ static const tid_t HTMLStyle_iface_tids[] = {
static dispex_static_data_t HTMLStyle_dispex = {
&HTMLStyle_dispex_vtbl,
DispHTMLStyle_tid,
HTMLStyle_iface_tids
HTMLStyle_iface_tids,
HTMLStyle_init_dispex_info
};
static HRESULT get_style_from_elem(HTMLElement *elem, nsIDOMCSSStyleDeclaration **ret)
......
......@@ -128,6 +128,32 @@ function test_xhr_props() {
next_test();
}
function test_style_props() {
var style = document.body.style;
function test_exposed(prop, expect) {
if(expect)
ok(prop in style, prop + " not found in style object.");
else
ok(!(prop in style), prop + " found in style object.");
}
var v = document.documentMode;
test_exposed("removeAttribute", true);
test_exposed("zIndex", true);
test_exposed("z-index", true);
test_exposed("filter", true);
test_exposed("pixelTop", true);
test_exposed("float", true);
test_exposed("css-float", false);
test_exposed("style-float", false);
test_exposed("setProperty", v >= 9);
test_exposed("removeProperty", v >= 9);
next_test();
}
function test_javascript() {
var g = window;
......@@ -270,6 +296,7 @@ var tests = [
test_window_props,
test_javascript,
test_xhr_props,
test_style_props,
test_elem_by_id,
test_conditional_comments
];
......@@ -208,6 +208,40 @@ function test_document_owner() {
next_test();
}
function test_style_properties() {
var style = document.body.style;
var val;
style.cssFloat = "left";
ok(style.cssFloat === "left", "cssFloat = " + style.cssFloat);
val = style.removeProperty("float");
ok(val === "left", "removeProperty() returned " + val);
ok(style.cssFloat === "", "cssFloat = " + style.cssFloat);
style.cssFloat = "left";
val = style.removeProperty("FloaT");
ok(val === "left", "removeProperty() returned " + val);
ok(style.cssFloat === "", "cssFloat = " + style.cssFloat);
style.cssFloat = "left";
val = style.removeProperty("cssFloat");
ok(val === "", "removeProperty() returned " + val);
ok(style.cssFloat === "left", "cssFloat = " + style.cssFloat);
ok(style["float"] === "left", "float = " + style["float"]);
style.testVal = "test";
val = style.removeProperty("testVal");
ok(val === "", "removeProperty() returned " + val);
ok(style.testVal === "test", "testVal = " + style.testVal);
style["z-index"] = 1;
ok(style.zIndex === 1, "zIndex = " + style.zIndex);
ok(style["z-index"] === 1, "z-index = " + style["z-index"]);
next_test();
}
var tests = [
test_input_selection,
test_textContent,
......@@ -217,5 +251,6 @@ var tests = [
test_iframe,
test_query_selector,
test_compare_position,
test_document_owner
test_document_owner,
test_style_properties
];
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment