Launch Week Day 1: Socket for Jira Is Now Available.Learn More
Socket
Book a DemoSign in
Socket

tofu-js

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tofu-js

A tiny JavaScript library that focuses on element manipulation including events, animations, and html parsing.

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
6
500%
Maintainers
1
Weekly downloads
 
Created
Source

Tofu.js

Originally developed in 2010 for use in Pinup, a graphical tool for tagging content within images on the web. This is a tiny JavaScript library that focuses on element manipulation including events, animations, and html parsing.

View Demo

Documentation

MethodDescription
addClassAdd one class to a provided element object.
addEventAdd one event listener to a provided element object that invokes a callback function.
animateAnimate one or more CSS properties for a provided element object.
appendTextInsert a text node at the end of a provided element object.
arrayUniqueReturns a new array of unique values from a provided array.
attributeDepending on the parameters provided, this method will add, remove, or get attribute values for a provided element object.
camelizeConvert a provided string into camel case.
cleanElementRemoves all event listeners, child nodes, and cache entries for a provided element object.
clickBinds a click event onto a provided element object.
cloneObjectReturns an exact duplicate of a provided object that has no reference to its former self.
domAppendInsert an element object at the end of a provided element object.
domWrapWrap an element object with a provided element object.
fadeInAnimate the opacity of an element object over a set time until it becomes opaque.
fadeOutAnimate the opacity of an element object over a set time until it becomes transparent.
fadeToAnimate the opacity of an element object over a set time until it becomes the desired opacity.
fireEventTrigger an event listener for a provided element object.
getComputedStylesReturns a normalized array of computed CSS styles for the provided element object.
getCumulativeOffsetReturns the offset from the outer most parent for a provided element object.
getElementsByClassNameReturns one or more matching element nodes from within the provided element node (or document body if none is provided).
getEventTargetRetrieves the associated element object from a provided event object.
getFileExtensionReturns the file extension from a provided URL string.
getGUIDReturns the GUID given to element objects by the library, or assigns one if none is found.
getHeightReturns the height of a provided element object.
getMousePositionReturns the current coordinates of the cursor.
getNextSiblingReturns the element object following the provided element object, or undefined if none was found.
getParamsFromObjectReturns a URL encoded string of parameters derived from a provided object.
getParentByClassNameRecursively looks for parent elements matching a provided class name. Returns the element object, or undefined if none were found.
getStyleReturns the requested computed style value of a provided element object.
getWidthReturns the width of a provided element object.
hasClassDetermines if a provided element object contains a specified class name.
hasEventDetermines if a provided element object has a specified event listener.
hasPropertyCross browser implementation of object.hasOwnProperty.
hideRenders a provided element object hidden (display none).
inArrayDetermines if a provided object is in an array.
insertAfterInsert an element object directly after a provided element object.
insertBeforeInsert an element object directly before a provided element object.
isArrayDetermines if a provided object is an array type.
isBooleanDetermines if a provided object is boolean type.
isDateDetermines if a provided object is a date type.
isElementDetermines if a provided object is an element type.
isElementEmptyDetermines if a provided element object has no child nodes.
isElementInDetermines if a provided element object is inside another provided element object.
isFunctionDetermines if a provided object is a function type.
isNullDetermines if a provided object is null.
isNumberDetermines if a provided object is a number type.
isNumericDetermines if a provided object is numerical.
isObjectDetermines if a provided object is an object type.
isObjectEmptyDetermines if a provided object is empty.
isStringDetermines if a provided object is a string type.
isUndefinedDetermines if a provided object is undefined.
isVisibleDetermines if a provided element object has been hidden using CSS (display/visibility).
loadJSONPRetrieves content using the JSONP method.
loadScriptLoads external JavaScript files from within the same origin.
loopPerforms a while loop using the given parameters.
loopArrayIterates over a provided array object and returns the index/value pairs.
loopObjectIterates over a provided object and returns the property/value pairs.
loopObjectKeysIterates over a provided object and returns the property names.
mergeObjectCombines two provided objects and returns the result.
newElementCreates and returns a new element object.
noConflictInforms the library not to bind with the dollar sign function to avoid conflicts with other libraries.
onDomReadyRuns a callback function when the Document Object Model is ready for use.
parseHTMLUses provided JSON data to build a document fragment.
parseUrlAnalyzes a provided URL string and returns information about its structure.
randomIDCreates a randomly generated string.
removeAllEventsRemoves all event listeners from a provided element object.
removeArrayItemRemoves all occurrences of an item within a provided array object.
removeChildrenRemoves all child nodes from a provided element object.
removeClassRemoves the specified class name from a provided element object.
removeElementRemoves a provided element object from the DOM.
removeEventRemoves a single event listener from a provided element object.
replaceElementReplace a provided element object with a provided element object.
replaceEventReplace a specified event listener with another listener of the same event type.
replaceHTMLReplace HTML within a provided element object using either an HTML string or a JSON representation (see parseHTML).
rloopPerforms a reverse while loop using the given parameters.
runIntervalPerforms a conditional check over intervals of time.
setAlphaChange the opacity of a provided element object.
setHeightChange the height value of a provided element object.
setStyleChange a single computed style of the provided element object.
setStylesChange multiple computed styles of the provided element object.
setWidthChange the width value of a provided element object.
showRenders a provided element object visible (display block).
stopAnimationForce a running animation to stop.
stopBubbleStops event propagation and prevents default actions of a provided event object.
stringFormatInserts array values into a provided string as specified.
stripSpacesRemoves all spaces within a provided string.
textContentRetrieve or insert a text node from within a provided element object. Returns undefined if no string is provided and no text node was found.
typeReturns a normalized type value of the provided object.

Screenshot

FAQs

Package last updated on 19 Sep 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts