aboutsummaryrefslogtreecommitdiffstats
path: root/docs/xml-docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs/xml-docs')
-rw-r--r--docs/xml-docs/fop/compiling.xml94
-rw-r--r--docs/xml-docs/fop/examples.xml20
-rw-r--r--docs/xml-docs/fop/implemented.xml17
3 files changed, 61 insertions, 70 deletions
diff --git a/docs/xml-docs/fop/compiling.xml b/docs/xml-docs/fop/compiling.xml
index 108b05575..0c7209f86 100644
--- a/docs/xml-docs/fop/compiling.xml
+++ b/docs/xml-docs/fop/compiling.xml
@@ -4,65 +4,49 @@
<!-- Compiling FOP -->
<s1 title="Compiling FOP">
- <s2 title="Prerequisites">
- <s3 title="Java 1.1.x or later">
- <p>If you use Java 1.1.x you must also seperately include the swing classes, which can
- be found at the <jump href="http://java.sun.com/products/jfc/#download-swing">
- Sun website</jump>. From Java 1.2 on (aka Java 2) they are part of the standard
- distribution.
- </p>
- </s3>
- <s3 title="An XML parser">
- <p>An XML parser which supports Sax and DOM like
- <jump href="http://xml.apache.org/xerces-j/index.html">Xerces-J</jump>.
- The parser must be in your classpath</p>
- </s3>
- <s3 title="The xslt processor Xalan ">
- <p>Some of the Java source code in FOP is generated from XML using
- XSLT. Xalan must be used to generate this code.</p>
- <p>Xalan is an XSL stylesheet processor written in java. At the moment you
- can't use any other processor, because the make process makes use of some
- proprietary features of Xalan which allow to write output in more
- then one document. You can find Xalan also at <jump href="http://xml.apache.org/xalan/overview.html">
- xml.apache.org</jump>. You have to use Xalan version 0.19.5 or later.
- Xalan.jar must be in your classpath and also the file bsf.jar, which comes with Xalan.</p>
- </s3>
- <s3 title="Setting of JAVA_HOME">
- <p>You have to set the enviroment variable JAVA_HOME. It must point to your local JDK
- root directory. This is true, even if you use JDK 1.2 or above, which don't need this
- setting. It is used by the compilation software.</p>
- </s3>
- <s3 title="Settings in your classpath">
- <p>If you want Fop to use the image library jimi, it should be in your classpath during
- compilation.
- </p>
- <p>A CLASSPATH for a complete compilation of Fop could look like this, if all these jar files are in
+ <p>Compilation is started by executing build, either as a batch file on win32 (build.bat) or as a shell script on unix. Before you
+ can start one of these scripts, you have to setup your classpath and the environment variable JAVA_HOME (see below).</p>
+ <p> The compilation uses Ant,
+ a replacement of make (you can find more information about Ant at
+ <jump href="http://jakarta.apache.org/ant/">jakarte.apache.org</jump>).
+ build.xml is the replacement of makefile. Look there for detailed information on the build
+ process and different targets. </p>
+ <p>A help screen is shown by calling "build usage".</p>
+ <p>If you only want to use Fop, you don't need to build it. A fop.jar comes with the distribution.</p>
+ <s2 title="Setting up your classpath">
+ <p>The build process relies on finding following libraries in your classpath (the version numbers indicate that building with them has been successfully tested, other, later versions may work too:</p>
+ <ul>
+ <li><jump href="http://xml.apache.org/xerces-j/index.html">Xerces-J</jump> version 1.2.1 (xml parser)</li>
+ <li><jump href="http://xml.apache.org/xalan/index.html">Xalan</jump> version 1.2 (xslt processor)</li>
+ <li>bsf.jar (comes with Xalan)</li>
+ <li>jimi.jar (image processing library) this file is optional </li>
+ </ul>
+ <p>Other needed libraries and classes come with Fop (in xml-fop/lib), but the build script sets the path to
+ them, so you only need to care about them, if you build Fop in any other way. See build.bat/build.sh for
+ details.
+ </p>
+ <p>A classpath for a complete compilation of Fop could look like this, if all these jar files are in
a directory called jars (example uses windows syntax):
</p>
- <p><code>set CLASSPATH=\jars\xalan.jar;\jars\xerces.jar;\jars\bsf.jar;\jars\jimi.jar;
+ <p><code>set CLASSPATH=\jars\xalan.jar; \jars\xerces.jar; \jars\bsf.jar; \jars\jimi.jar;
</code></p>
- </s3>
</s2>
- <s2 title="Compiling">
- <p>Compilation is started by executing build, either as a batch file on win32 (build.bat) or as a shell script on unix. The compilation uses Ant,
- a replacement of make (you can find more information about Ant at
- <jump href="http://jakarta.apache.org/ant/">jakarte.apache.org</jump>).
- build.xml is the replacement of makefile. Look there for further information. </p>
- <p>A help screen is shown by calling "build usage".
- </p>
- </s2>
+ <s2 title="Setting of JAVA_HOME">
+ <p>You have to set the enviroment variable JAVA_HOME. It must point to your local JDK
+ root directory. This is true, even if you use JDK 1.2 or above, which normally don't need this
+ setting. It is used by Ant, the compilation software.</p>
+ </s2>
<s2 title="Problems">
- <p>If you have problems compiling Fop, please try this first: delete the build directory completely and
- try a new build from scratch. Check, whether you have all necessary libraries in your classpath:
- xerces.jar, xalan.jar, bsf.jar, jimi.jar (optional). If you still have problems, please look at the
- page <jump href="bugs.html">bugs</jump>, for further help.
- </p>
- </s2>
-
- <s2 title="Compiling FOP on MacOS">
- <!-- contributed by Arved Sandstrom who also manages the webpage the jump points to -->
- <p>We strongly recommend the use of Codewarrior Java. You will find
- a link to more information in the near future.
- </p>
+ <p>If you have problems compiling Fop, please try this first: </p>
+ <ul>
+ <li>delete the build directory completely and try a new build from scratch</li>
+ <li>check, whether you have all necessary libraries in your classpath:
+ xerces.jar, xalan.jar, bsf.jar, jimi.jar (optional)</li>
+ <li>check, whether you have the required versions of Xerces (>= 1.2.1) and Xalan (>=1.2) </li>
+ <li>check, whether you have an older version of xerces.jar, xalan.jar, w3c.jar somewhere in
+ you classpath.</li>
+ </ul>
+ <p>If you still have problems, please look at the
+ page <jump href="bugs.html">bugs</jump>, for further help.</p>
</s2>
</s1>
diff --git a/docs/xml-docs/fop/examples.xml b/docs/xml-docs/fop/examples.xml
index 33fd84af8..25fb4899c 100644
--- a/docs/xml-docs/fop/examples.xml
+++ b/docs/xml-docs/fop/examples.xml
@@ -6,16 +6,21 @@
<s1 title="Examples">
<p>Examples for the use of xsl:fo can be found in the Fop distribution in
the subdirectory xml-fop/docs/examples/fo. You can start transformation of all fo files into pdf
- files by starting xml-fop/docs/examples/runtests.
+ files by starting xml-fop/docs/examples/runtests. The resulting test files can be found in
+ xml-fop/docs/examples/tests
</p>
<p>At the moment the following files are part of the distribution:</p>
<ul>
- <li>normal.fo - a very simple file showing the use of a 2 level of headings, normal text and a header.
+ <li>simple.fo - a very simple file which gives use a first impression of the structure of an fo file
+ </li>
+ <li>normal.fo - a simple file showing the use of a 2 level of headings, normal text and a header.
</li>
<li>table.fo - a simple table
</li>
<li>list.fo - a simple list
</li>
+ <li>list2.fo - some list examples
+ </li>
<li>images.fo - shows how to embed gif and jpg images into the xsl:fo file using external-graphic.
</li>
<li>border.fo - a not so simple example how to use borders in tables
@@ -25,6 +30,17 @@
</li>
<li>leader.fo - a very simple example of a rule
</li>
+ <li>normalex.fo - shows the use of computed property values
+ </li>
+ <li>inhprop.fo - shows the use of inherited property values
+ </li>
+ <li>instream.fo - shows the use of fo:instream-foreign-object together with svg
+ </li>
+ <li>inhprop.fo - shows the use of inherited property values
+ </li>
+ <li>textdeko.fo - shows the use of the property textdecoration
+ </li>
+
<li>Look also into the directory examples/svg. There you find some very extensive svg examples.
Just start makedoc.
</li>
diff --git a/docs/xml-docs/fop/implemented.xml b/docs/xml-docs/fop/implemented.xml
index 2693363b4..982611348 100644
--- a/docs/xml-docs/fop/implemented.xml
+++ b/docs/xml-docs/fop/implemented.xml
@@ -92,7 +92,7 @@
<s2 title="2) Properties">
- <p>Property values can be computed</p>
+ <p>Property values can be computed. Compound properties are also understood by Fop.</p>
<ul>
<li>background-color </li>
<li>blank-or-not-blank</li>
@@ -144,7 +144,7 @@
<li>id</li>
<li>initial-page-number</li>
<li>internal-destination</li>
- <li>keep-with-next</li>
+ <li>keep-with-next (broken)</li>
<li>left</li>
<li>line-height </li>
<li>margin-bottom (only on pages and regions) </li>
@@ -181,10 +181,11 @@
<li>text-align-last </li>
<li>text-indent </li>
<li>top</li>
- <li>white-space-treatment </li>
+ <li>white-space-treatment (broken)</li>
<li>width</li>
<li>wrap-option</li>
</ul>
+ <p>All other properties are not implemented.</p>
</s2>
<s2 title="3) SVG elements supported">
@@ -259,13 +260,3 @@
</s2>
</s1>
-
-
-
-
-
-
-
-
-
-
Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
/*
 * jQuery UI Menu @VERSION
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Menu
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.widget.js
 */
(function($) {

var idIncrement = 0;

$.widget( "ui.menu", {
	version: "@VERSION",
	defaultElement: "<ul>",
	delay: 300,
	options: {
		menus: "ul",
		position: {
			my: "left top",
			at: "right top"
		}
	},
	_create: function() {
		this.activeMenu = this.element;
		this.menuId = this.element.attr( "id" ) || "ui-menu-" + idIncrement++;
		if ( this.element.find( ".ui-icon" ).length ) {
			this.element.addClass( "ui-menu-icons" );
		}
		this.element
			.addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
			.attr({
				id: this.menuId,
				role: "menu"
			})
			// need to catch all clicks on disabled menu
			// not possible through _bind
			.bind( "click.menu", $.proxy( function( event ) {
				if ( this.options.disabled ) {
					event.preventDefault();
				}
			}, this));
		this._bind({
			// Prevent focus from sticking to links inside menu after clicking
			// them (focus should always stay on UL during navigation).
			"mousedown .ui-menu-item > a": function( event ) {
				event.preventDefault();
			},
			"click .ui-menu-item:has(a)": function( event ) {
				event.stopImmediatePropagation();
				this.select( event );
				// Redirect focus to the menu with a delay for firefox
				this._delay( function() {
					if ( !this.element.is(":focus") ) {
						this.element.focus();
					}
				}, 20);
			},
			"mouseover .ui-menu-item": function( event ) {
				event.stopImmediatePropagation();
				var target = $( event.currentTarget );
				// Remove ui-state-active class from siblings of the newly focused menu item to avoid a jump caused by adjacent elements both having a class with a border
				target.siblings().children( ".ui-state-active" ).removeClass( "ui-state-active" );
				this.focus( event, target );
			},
			"mouseleave": "collapseAll",
			"mouseleave .ui-menu": "collapseAll",
			"focus": function( event ) {
				var firstItem = this.element.children( ".ui-menu-item" ).eq( 0 );
				if ( this._hasScroll() && !this.active ) {
					var menu = this.element;
					menu.children().each( function() {
						var currentItem = $( this );
						if ( currentItem.offset().top - menu.offset().top >= 0 ) {
							firstItem = currentItem;
							return false;
						}
					});
				} else if ( this.active ) {
					firstItem = this.active;
				}
				this.focus( event, firstItem );
			},
			blur: function( event ) {
				this._delay( function() {
					if ( ! $.contains( this.element[0], this.document[0].activeElement ) ) {
						this.collapseAll( event );
					}
				}, 0);
			}
		});

		this.refresh();

		this.element.attr( "tabIndex", 0 );
		this._bind({
			"keydown": function( event ) {
				switch ( event.keyCode ) {
				case $.ui.keyCode.PAGE_UP:
					this.previousPage( event );
					event.preventDefault();
					event.stopImmediatePropagation();
					break;
				case $.ui.keyCode.PAGE_DOWN:
					this.nextPage( event );
					event.preventDefault();
					event.stopImmediatePropagation();
					break;
				case $.ui.keyCode.HOME:
					this._move( "first", "first", event );
					event.preventDefault();
					event.stopImmediatePropagation();
					break;
				case $.ui.keyCode.END:
					this._move( "last", "last", event );
					event.preventDefault();
					event.stopImmediatePropagation();
					break;
				case $.ui.keyCode.UP:
					this.previous( event );
					event.preventDefault();
					event.stopImmediatePropagation();
					break;
				case $.ui.keyCode.DOWN:
					this.next( event );
					event.preventDefault();
					event.stopImmediatePropagation();
					break;
				case $.ui.keyCode.LEFT:
					if (this.collapse( event )) {
						event.stopImmediatePropagation();
					}
					event.preventDefault();
					break;
				case $.ui.keyCode.RIGHT:
					if (this.expand( event )) {
						event.stopImmediatePropagation();
					}
					event.preventDefault();
					break;
				case $.ui.keyCode.ENTER:
					if ( this.active.children( "a[aria-haspopup='true']" ).length ) {
						if ( this.expand( event ) ) {
							event.stopImmediatePropagation();
						}
					}
					else {
						this.select( event );
						event.stopImmediatePropagation();
					}
					event.preventDefault();
					break;
				case $.ui.keyCode.ESCAPE:
					if ( this.collapse( event ) ) {
						event.stopImmediatePropagation();
					}
					event.preventDefault();
					break;
				default:
					event.stopPropagation();
					clearTimeout( this.filterTimer );
					var match,
						prev = this.previousFilter || "",
						character = String.fromCharCode( event.keyCode ),
						skip = false;

					if (character == prev) {
						skip = true;
					} else {
						character = prev + character;
					}
					function escape( value ) {
						return value.replace( /[-[\]{}()*+?.,\\^$|#\s]/g , "\\$&" );
					}
					match = this.activeMenu.children( ".ui-menu-item" ).filter( function() {
						return new RegExp("^" + escape(character), "i")
							.test( $( this ).children( "a" ).text() );
					});
					match = skip && match.index(this.active.next()) != -1 ? this.active.nextAll(".ui-menu-item") : match;
					if ( !match.length ) {
						character = String.fromCharCode(event.keyCode);
						match = this.activeMenu.children(".ui-menu-item").filter( function() {
							return new RegExp("^" + escape(character), "i")
								.test( $( this ).children( "a" ).text() );
						});
					}
					if ( match.length ) {
						this.focus( event, match );
						if (match.length > 1) {
							this.previousFilter = character;
							this.filterTimer = this._delay( function() {
								delete this.previousFilter;
							}, 1000 );
						} else {
							delete this.previousFilter;
						}
					} else {
						delete this.previousFilter;
					}
				}
			}
		});

		this._bind( this.document, {
			click: function( event ) {
				if ( !$( event.target ).closest( ".ui-menu" ).length ) {
					this.collapseAll( event );
				}
			}
		});
	},

	_destroy: function() {
		//destroy (sub)menus
		this.element
			.removeAttr( "aria-activedescendant" )
			.find( ".ui-menu" )
			.andSelf()
			.removeClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
			.removeAttr( "role" )
			.removeAttr( "tabIndex" )
			.removeAttr( "aria-labelledby" )
			.removeAttr( "aria-expanded" )
			.removeAttr( "aria-hidden" )
			.show();

		//destroy menu items
		this.element.find( ".ui-menu-item" )
			.unbind( ".menu" )
			.removeClass( "ui-menu-item" )
			.removeAttr( "role" )
			.children( "a" )
			.removeClass( "ui-corner-all ui-state-hover" )
			.removeAttr( "tabIndex" )
			.removeAttr( "role" )
			.removeAttr( "aria-haspopup" )
			.removeAttr( "id" )
			.children( ".ui-icon" )
			.remove();
	},

	refresh: function() {
		// initialize nested menus
		var submenus = this.element.find( this.options.menus + ":not( .ui-menu )" )
			.addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
			.attr( "role", "menu" )
			.hide()
			.attr( "aria-hidden", "true" )
			.attr( "aria-expanded", "false" );

		// don't refresh list items that are already adapted
		var menuId = this.menuId;
		submenus.add( this.element ).children( ":not( .ui-menu-item ):has( a )" )
			.addClass( "ui-menu-item" )
			.attr( "role", "presentation" )
			.children( "a" )
				.addClass( "ui-corner-all" )
				.attr( "tabIndex", -1 )
				.attr( "role", "menuitem" )
				.attr( "id", function( i ) {
					return menuId + "-" + i;
				});

		submenus.each( function() {
			var menu = $( this ),
				item = menu.prev( "a" );

			item.attr( "aria-haspopup", "true" )
				.prepend( '<span class="ui-menu-icon ui-icon ui-icon-carat-1-e"></span>' );
			menu.attr( "aria-labelledby", item.attr( "id" ) );
		});
	},

	focus: function( event, item ) {
		this.blur( event );

		if ( this._hasScroll() ) {
			var borderTop = parseFloat( $.curCSS( this.activeMenu[0], "borderTopWidth", true ) ) || 0,
				paddingTop = parseFloat( $.curCSS( this.activeMenu[0], "paddingTop", true ) ) || 0,
				offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop,
				scroll = this.activeMenu.scrollTop(),
				elementHeight = this.activeMenu.height(),
				itemHeight = item.height();

			if ( offset < 0 ) {
				this.activeMenu.scrollTop( scroll + offset );
			} else if ( offset + itemHeight > elementHeight ) {
				this.activeMenu.scrollTop( scroll + offset - elementHeight + itemHeight );
			}
		}

		this.active = item.first()
			.children( "a" )
				.addClass( "ui-state-focus" )
			.end();
		this.element.attr( "aria-activedescendant", this.active.children( "a" ).attr( "id" ) );

		// highlight active parent menu item, if any
		this.active.parent().closest( ".ui-menu-item" ).children( "a:first" ).addClass( "ui-state-active" );

		this.timer = this._delay( function() {
			this._close();
		}, this.delay );

		var nested = $( "> .ui-menu", item );
		if ( nested.length && ( /^mouse/.test( event.type ) ) ) {
			this._startOpening(nested);
		}
		this.activeMenu = item.parent();

		this._trigger( "focus", event, { item: item } );
	},

	blur: function( event ) {
		clearTimeout( this.timer );

		if ( !this.active ) {
			return;
		}

		this.active.children( "a" ).removeClass( "ui-state-focus" );
		this.active = null;

		this._trigger( "blur", event, { item: this.active } );
	},

	_startOpening: function( submenu ) {
		clearTimeout( this.timer );

		// Don't open if already open fixes a Firefox bug that caused a .5 pixel
		// shift in the submenu position when mousing over the carat icon
		if ( submenu.attr( "aria-hidden" ) !== "true" ) {
			return;
		}

		this.timer = this._delay( function() {
			this._close();
			this._open( submenu );
		}, this.delay );
	},

	_open: function( submenu ) {
		clearTimeout( this.timer );
		this.element
			.find( ".ui-menu" )
			.not( submenu.parents() )
			.hide()
			.attr( "aria-hidden", "true" );

		var position = $.extend({}, {
				of: this.active
			}, $.type(this.options.position) == "function"
				? this.options.position(this.active)
				: this.options.position
			);

		submenu.show()
			.removeAttr( "aria-hidden" )
			.attr( "aria-expanded", "true" )
			.position( position );
	},

	collapseAll: function( event, all ) {
		clearTimeout( this.timer );
		this.timer = this._delay( function() {
			// if we were passed an event, look for the submenu that contains the event
			var currentMenu = all ? this.element :
				$( event && event.target ).closest( this.element.find( ".ui-menu" ) );

			// if we found no valid submenu ancestor, use the main menu to close all sub menus anyway
			if ( !currentMenu.length ) {
				currentMenu = this.element;
			}

			this._close( currentMenu );

			this.blur( event );
			this.activeMenu = currentMenu;
		}, this.delay);
	},

	// With no arguments, closes the currently active menu - if nothing is active
	// it closes all menus.  If passed an argument, it will search for menus BELOW
	_close: function( startMenu ) {
		if ( !startMenu ) {
			startMenu = this.active ? this.active.parent() : this.element;
		}

		startMenu
			.find( ".ui-menu" )
				.hide()
				.attr( "aria-hidden", "true" )
				.attr( "aria-expanded", "false" )
			.end()
			.find( "a.ui-state-active" )
			.removeClass( "ui-state-active" );
	},

	collapse: function( event ) {
		var newItem = this.active && this.active.parent().closest( ".ui-menu-item", this.element );
		if ( newItem && newItem.length ) {
			this._close();
			this.focus( event, newItem );
			return true;
		}
	},

	expand: function( event ) {
		var newItem = this.active && this.active.children( ".ui-menu " ).children( ".ui-menu-item" ).first();

		if ( newItem && newItem.length ) {
			this._open( newItem.parent() );

			//timeout so Firefox will not hide activedescendant change in expanding submenu from AT
			this._delay( function() {
				this.focus( event, newItem );
			}, 20 );
			return true;
		}
	},

	next: function(event) {
		this._move( "next", "first", event );
	},

	previous: function(event) {
		this._move( "prev", "last", event );
	},

	isFirstItem: function() {
		return this.active && !this.active.prevAll( ".ui-menu-item" ).length;
	},

	isLastItem: function() {
		return this.active && !this.active.nextAll( ".ui-menu-item" ).length;
	},

	_move: function( direction, filter, event ) {
		if ( !this.active ) {
			this.focus( event, this.activeMenu.children( ".ui-menu-item" )[ filter ]() );
			return;
		}

		var next;
		if ( direction === "first" || direction === "last" ) {
			next = this.active[ direction === "first" ? "prevAll" : "nextAll" ]( ".ui-menu-item" ).eq( -1 );
		} else {
			next = this.active[ direction + "All" ]( ".ui-menu-item" ).eq( 0 );
		}

		if ( next.length ) {
			this.focus( event, next );
		} else {
			this.focus( event, this.activeMenu.children( ".ui-menu-item" )[ filter ]() );
		}
	},

	nextPage: function( event ) {
		if ( !this.active ) {
			this.focus( event, this.activeMenu.children( ".ui-menu-item" ).first() );
			return;
		}
		if ( this.isLastItem() ) {
			return;
		}
		if ( this._hasScroll() ) {
			var base = this.active.offset().top,
				height = this.element.height(),
				result;
			this.active.nextAll( ".ui-menu-item" ).each( function() {
				result = $( this );
				return $( this ).offset().top - base - height < 0;
			});

			this.focus( event, result );
		} else {
			this.focus( event, this.activeMenu.children( ".ui-menu-item" )
				[ !this.active ? "first" : "last" ]() );
		}
	},

	previousPage: function( event ) {
		if ( !this.active ) {
			this.focus( event, this.activeMenu.children( ".ui-menu-item" ).first() );
			return;
		}
		if ( this.isFirstItem() ) {
			return;
		}
		if ( this._hasScroll() ) {
			var base = this.active.offset().top,
				height = this.element.height(),
				result;
			this.active.prevAll( ".ui-menu-item" ).each( function() {
				result = $( this );
				return $(this).offset().top - base + height > 0;
			});

			this.focus( event, result );
		} else {
			this.focus( event, this.activeMenu.children( ".ui-menu-item" ).first() );
		}
	},

	_hasScroll: function() {
		return this.element.outerHeight() < this.element.prop( "scrollHeight" );
	},

	select: function( event ) {

		// save active reference before collapseAll triggers blur
		var ui = {
			item: this.active
		};
		this.collapseAll( event, true );
		this._trigger( "select", event, ui );
	}
});

}( jQuery ));