mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-29 09:52:03 +00:00
CPCompatibility: Return nil for style properties without a DOM
CPBrowserStyleProperty created a test element without checking for a DOM, throwing a ReferenceError outside a browser. Because initializing an animator proxy calls this function, -animator could not be used in the test suite. CPBrowserStyleProperty now returns nil when no DOM is available.
This commit is contained in:
1 parent
b792073dcf
commit
49e0407ef4
2 files changed
+21
No files matched your search
@@ -412,6 +412,16 @@ function CPBrowserStyleProperty(aProperty)
|
||||
{
|
||||
var lowerProperty = aProperty.toLowerCase();
|
||||
|
||||
/*
|
||||
Without a DOM there is no style to test, so no property is supported.
|
||||
|
||||
2026-11-23: the function created a test element without checking for a DOM. Outside a
|
||||
browser, the first call threw a ReferenceError; the first use of an animator proxy
|
||||
makes that call, so -animator could not be used in the test suite.
|
||||
*/
|
||||
if (!CPDOMAvailable)
|
||||
return nil;
|
||||
|
||||
if (PLATFORM_STYLE_JS_PROPERTIES[lowerProperty] === undefined)
|
||||
{
|
||||
var r = nil;
|
||||
|
||||
@@ -51,6 +51,17 @@ var SafariUserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebK
|
||||
[self fail:@"CPCompatibility.j threw while loading under a WebKit user agent: " + loadException];
|
||||
}
|
||||
|
||||
/*
|
||||
The test suite runs without a DOM, so it states that a style property lookup outside a
|
||||
browser finds no property and does not throw.
|
||||
*/
|
||||
- (void)testAStylePropertyLookupWithoutADOMFindsNoProperty
|
||||
{
|
||||
[self assert:NO equals:CPDOMAvailable message:@"the test suite runs without a DOM"];
|
||||
[self assertNull:CPBrowserStyleProperty(@"animation") message:@"no style property is found"];
|
||||
[self assertNull:CPBrowserCSSProperty(@"animation") message:@"no CSS property is found"];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
function compatibilityExecutable()
|
||||
|
||||
Reference in new issue
Block a user