WebDocumentText Protocol Reference

Conforms to
Framework
/System/Library/Frameworks/WebKit.framework
Availability
Available in OS X v10.2 with Safari 1.0 and later.
Available in OS X v10.2.7 and later.
Companion guide
Declared in
WebDocument.h

Overview

WebDocumentText is an optional protocol for document view objects that display text. This protocol defines methods for accessing document content as strings, and methods for text selection. Classes that adopt this protocol should also adopt WebDocumentView and inherit from NSView.

Tasks

Getting Document Content

Selecting and Deselecting Text

Text Encoding

Instance Methods

attributedString

Returns the entire content of the web document as an attributed string.

- (NSAttributedString *)attributedString
Return Value

An attributed string containing the entire content of the web document.

Availability
  • Available in OS X v10.2 with Safari 1.0 and later.
  • Available in OS X v10.2.7 and later.
See Also
Declared In
WebDocument.h

deselectAll

Deselects the currently selected text in the web document.

- (void)deselectAll
Availability
  • Available in OS X v10.2 with Safari 1.0 and later.
  • Available in OS X v10.2.7 and later.
Declared In
WebDocument.h

selectAll

Selects all the text in the web document.

- (void)selectAll
Availability
  • Available in OS X v10.2 with Safari 1.0 and later.
  • Available in OS X v10.2.7 and later.
Declared In
WebDocument.h

selectedAttributedString

Returns the currently selected text in the web document as an attributed string.

- (NSAttributedString *)selectedAttributedString
Return Value

An attributed string containing the currently selected text in the web document.

Availability
  • Available in OS X v10.2 with Safari 1.0 and later.
  • Available in OS X v10.2.7 and later.
Declared In
WebDocument.h

selectedString

Returns the currently selected text in the web document as a string.

- (NSString *)selectedString
Return Value

The currently selected text in the web document.

Availability
  • Available in OS X v10.2 with Safari 1.0 and later.
  • Available in OS X v10.2.7 and later.
Declared In
WebDocument.h

string

Returns the entire content of the web document as a string.

- (NSString *)string
Return Value

The entire content of the web document.

Availability
  • Available in OS X v10.2 with Safari 1.0 and later.
  • Available in OS X v10.2.7 and later.
Declared In
WebDocument.h

supportsTextEncoding

Returns a Boolean value that indicates whether the web document supports text encoding.

- (BOOL)supportsTextEncoding
Return Value

YES if the web document supports text encoding; otherwise, NO.

Availability
  • Available in OS X v10.2 with Safari 1.0 and later.
  • Available in OS X v10.2.7 and later.
Declared In
WebDocument.h