Code collapse functions let you visually collapse and expand code. You can collapse or expand arbitrary selections of code, or fragments between opening and closing tags. Although the code collapse functions exist in both the dom and htmlInspector, the collapsed ranges are the same in both Code view and Cold Inspector.

dom.collapseFullTag()

Availability

Dreamweaver 8.

Description

This function determines whether the selection in Code view is entirely within a single pair of start and end tags or contains a single pair of start and end tags. If so, it collapses the code fragment that starts just before the start tag and ends after the end tag; if not, the function does nothing.

Arguments

allowCodeFragmentAdjustment

  • The allowCodeFragmentAdjustment argument is a required, Boolean value. If true, this argument currently has no effect, or has the same effect as a value of false. If false, Dreamweaver collapses the code that begins immediately before the opening tag and ends immediately after the ending tag without any modification.

Returns

Nothing.

Example

The following example collapses the code fragment in the current selection in Code view that starts just before the start tag and ends just after the end tag:

 var currentDOM = dw.getDocumentDOM(); 
currentDOM.collapseFullTag(false);

dom.collapseFullTagInverse()

Availability

Dreamweaver 8.

Description

This function determines whether the selection in Code view is entirely within a single pair of start and end tags or contains a single pair of start and end tags. If so, it collapses the code that precedes the start tag and the code that follows the end tag; if not, the function does nothing.

Arguments

allowAdjustmentOfCodeFragments

  • The allowAdjustmentOfCodeFragments argument is a required, Boolean value. If true, Dreamweaver adjusts the boundaries of the code before the start tag and of the code after the end tag to perform a smart collapse, which preserves current indenting and spacing. If false, Dreamweaver collapses the code fragments that are before the open tag and after the end tag exactly as indicated by the selection.

Returns

Nothing.

Example

The following example adjusts the boundaries of the code before the starting tag after the ending tag to perform a smart collapse that preserves indenting and spacing:

 var currentDOM = dw.getDocumentDOM(); 
currentDOM.collapseFullTagInverse(true);

dom.collapseSelectedCodeFragment()

Availability

Dreamweaver 8.

Description

This function collapses the selected code in Code view. If the selection is already collapsed, this function does nothing.

Arguments

allowCodeFragmentAdjustment

  • The allowCodeFragmentAdjustment is a required, Boolean value. If true, Dreamweaver modifies the boundaries of the current selection to perform a smart collapse, which preserves current indenting and spacing. If false, Dreamweaver collapses the currently selected code fragment exactly as indicated by the selection.

Returns

Nothing.

Example

The following example collapses the selected code fragment, without modification, in Code view:

 var currentDOM = dw.getDocumentDOM(); 
currentDOM.collapseSelectedCodeFragment(false);

dom.collapseSelectedCodeFragmentInverse()

Availability

Dreamweaver 8.

Description

This function collapses all code before and after the selected code in Code view.

Arguments

allowAdjustmentOfCodeFragments

  • The allowAdjustmentOfCodeFragments argument is a required, Boolean value. If true, Dreamweaver adjusts the boundaries of the code before and after the current selection to perform a smart collapse, which preserves the current indenting and spacing. If false, Dreamweaver collapses the code fragments exactly as indicated by the selection.

Returns

Nothing.

Example

The following example adjusts and then collapses all code before and after the selected code in Code view:

 var currentDOM = dw.getDocumentDOM(); 
currentDOM.collapseSelectedCodeFragmentInverse(true);

dom.expandAllCodeFragments()

Availability

Dreamweaver 8.

Description

This function expands all collapsed code fragments in Code view, including nested collapsed code fragments.

Arguments

None.

Returns

Nothing.

Example

The following example expands all collapsed code in Code view:

 var currentDOM = dw.getDocumentDOM(); 
currentDOM.expandAllCodeFragments();

dom.expandSelectedCodeFragments()

Availability

Dreamweaver 8.

Description

This function expands all collapsed code fragments in Code view that are within the current selection. If the selection is already expanded, this function does nothing.

Arguments

None.

Returns

Nothing.

Example

The following example expands all collapsed code in the current selection in Code view:

 var currentDOM = dw.getDocumentDOM(); 
currentDOM.expandSelectedCodeFragments();

dreamweaver.htmlInspector.collapseFullTag()

Availability

Dreamweaver 8.

Description

This function determines whether the selection in the Code inspector is entirely within a single pair of start and end tags or contains a single pair of start and end tags. If so, it collapses the code fragment that starts just before the start tag and ends after the end tag; if not, the function does nothing.

Arguments

allowACodeFragmentAdjustment

  • The allowCodeFragmentAdjustment argument is a required, Boolean value. If true, this argument currently has no effect, or has the same effect as a value of false. If false, Dreamweaver collapses the code that begins immediately before the opening tag and ends immediately after the ending tag, without any modification.

Returns

Nothing.

Example

The following example collapses the code fragment in the current selection in the Code inspector that starts just before the start tag and ends just after the end tag:

 dreamweaver.htmlInspector.collapseFullTag(false);

dreamweaver.htmlInspector.collapseFullTagInverse()

Availability

Dreamweaver 8.

Description

This function determines whether the selection in the Code inspector is entirely within a single pair of start and end tags or contains a single pair of start and end tags. If so, it collapses the code before the start tag and the code after the end tag; if not, the function does nothing.

Arguments

allowAdjustmentOfCodeFragments

  • The allowAdjustmentOfCodeFragments argument is a required, Boolean value. If true, Dreamweaver adjusts the boundaries of the code before the start tag and of the code after the end tag to perform a smart collapse, which preserves the existing indenting and spacing. If false, Dreamweaver collapses the code before the open tag and the code after the end tag, without any modifications.

Returns

Nothing.

Example

The following example performs a smart collapse on the code sections occurring before the starting tag and after the ending tag of the current selection:

 dreamweaver.htmlInspector.collapseFullTagInverse(true);

dreamweaver.htmlInspector.collapseSelectedCodeFragment()

Availability

Dreamweaver 8.

Description

This function collapses the selected code in the Code inspector. If the selection is already collapsed, this function does nothing.

Arguments

allowCodeFragmentAdjustment

  • The allowCodeFragmentAdjustment is a required, Boolean value. If true, Dreamweaver modifies the current selection to perform a smart collapse, which preserves the existing indenting and spacing. If false, Dreamweaver collapses the currently selected code fragment exactly as indicated by the selection.

Returns

Nothing.

Example

The following example adjusts and collapses the selected code in the Code inspector:

 dreamweaver.htmlInspector.collapseSelectedCodeFragment(true);

dreamweaver.htmlInspector.collapseSelectedCodeFragmentInverse()

Availability

Dreamweaver 8.

Description

This function collapses all code before and after the selected code in the Code inspector. If the selection is already collapsed, this function does nothing.

Arguments

allowAdjustmentOfCodeFragments

  • The allowAdjustmentOfCodeFragments argument is a required, Boolean value. If true, Dreamweaver adjusts the boundaries of the code sections before and after the current selection to perform a smart collapse, which preserves the current indenting and spacing. If false, Dreamweaver collapses the code sections exactly as indicated by the selection.

Returns

Nothing.

Example

The following example collapses all code before and after the selected code in the Code inspector, exactly as indicated by the selection:

 dreamweaver.htmlInspector.collapseSelectedCodeFragmentInverse(false);

dreamweaver.htmlInspector.expandAllCodeFragments()

Availability

Dreamweaver 8.

Description

This function expands all collapsed code fragments in the Code inspector, including nested collapsed code fragments.

Arguments

None.

Returns

Nothing.

Example

The following example expands all collapsed code in the Code inspector:

 dreamweaver.htmlInspector.expandAllCodeFragments();

dreamweaver.htmlInspector.expandSelectedCodeFragments()

Availability

Dreamweaver 8.

Description

This function expands all collapsed code fragments within the current selection in the Code inspector. If the selection is already expanded, this function does nothing.

Arguments

None.

Returns

Nothing.

Example

The following example expands all collapsed code in the current selection in the Code inspector:

 dreamweaver.htmlInspector.expandSelectedCodeFragments();

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy