<!--
{
  "availability" : [
    "macOS: 10.3.0 - 10.14.0"
  ],
  "documentType" : "symbol",
  "framework" : "WebKit",
  "identifier" : "/documentation/WebKit/WebEditingDelegate/webView(_:shouldApplyStyle:toElementsIn:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "WebKit"
    ],
    "preciseIdentifier" : "c:objc(pl)WebEditingDelegate(im)webView:shouldApplyStyle:toElementsInDOMRange:"
  },
  "title" : "webView(_:shouldApplyStyle:toElementsIn:)"
}
-->

# webView(_:shouldApplyStyle:toElementsIn:)

Returns whether the user should be allowed to apply a style to a range of content.

```
optional func webView(_ webView: WebView!, shouldApplyStyle style: DOMCSSStyleDeclaration!, toElementsIn range: DOMRange!) -> Bool
```

## Parameters

`webView`

The web view that the user is editing.

`style`

The style to apply.

`range`

The range of the content.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the user should be allowed to apply the style to the content range; otherwise, <doc://com.apple.documentation/documentation/Swift/false>.

## See Also

  [WebKit Objective-C Programming Guide](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/DisplayWebContent/DisplayWebContent.html#//apple_ref/doc/uid/10000164i)



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)