| name | webf-api-compatibility |
| description | Check Web API and CSS feature compatibility in WebF - determine what JavaScript APIs, DOM methods, CSS properties, and layout modes are supported. Use when planning features, debugging why APIs don't work, or finding alternatives for unsupported features like IndexedDB, WebGL, float layout, or CSS Grid. |
WebF API & CSS Compatibility
Note: WebF development is nearly identical to web development - you use the same tools (Vite, npm, Vitest), same frameworks (React, Vue, Svelte), and same deployment services (Vercel, Netlify). This skill covers one of the 3 key differences: checking API and CSS compatibility before implementation. The other two differences are async rendering and routing.
WebF is NOT a browser - it's a Flutter application runtime that implements W3C/WHATWG web standards. This means some browser APIs are not available, and some CSS features work differently.
This skill helps you quickly check what's supported and find alternatives for unsupported features.
Quick Compatibility Check
When asked about a specific API or CSS feature, I will:
- Check if it's in the supported list
- Provide the compatibility status (ā
Supported, ā³ Coming Soon, ā Not Supported)
- Explain why it's not supported (if applicable)
- Suggest alternatives or workarounds
JavaScript & Web APIs
ā
Fully Supported
Timers & Animation
setTimeout(), clearTimeout()
setInterval(), clearInterval()
requestAnimationFrame(), cancelAnimationFrame()
Networking
fetch() - Full support with async/await
XMLHttpRequest - For legacy code
WebSocket - Real-time bidirectional communication
EventSource - Server-Sent Events (SSE) for real-time server push
URL and URLSearchParams - URL manipulation
Storage
localStorage - Persistent key-value storage
sessionStorage - Session-only storage
Graphics
- Canvas 2D - Full 2D canvas API
- SVG - SVG element rendering
DOM APIs
document, window, navigator
querySelector(), querySelectorAll()
addEventListener(), removeEventListener()
createElement(), appendChild(), etc.
MutationObserver - Watch DOM changes
- Custom Elements - Define custom HTML elements
Events
click - Enabled by default
- Other events via
FlutterGestureDetector (double-tap, long-press, etc.)
ā³ Coming Soon
- CSS Grid - Planned for future release
- Tailwind CSS v4 - Planned for 2026
ā NOT Supported
Storage
- IndexedDB - Use native plugin instead
- Alternative:
sqflite, hive, or custom plugin
Graphics
- WebGL - Not available, no alternative
- Web Animations API (JavaScript) - CSS animations work, but not the JS API
Workers
- Web Workers - Not needed
- Why: JavaScript already runs on dedicated thread in WebF
- No performance benefit from workers
DOM
- Shadow DOM - Not used for component encapsulation
- Use framework component systems instead (React, Vue, etc.)
Observers
- IntersectionObserver - Use
onscreen/offscreen events instead
CSS Compatibility
ā
Fully Supported Layout Modes
Standard Flow
block - Block-level elements
inline - Inline elements
inline-block - Inline elements with block properties
Flexbox (Recommended)
display: flex
- All flex properties (
justify-content, align-items, flex-direction, etc.)
- This is the recommended layout approach
Positioned Layout
position: relative
position: absolute
position: fixed
position: sticky
Text & Direction
- RTL (right-to-left) support
- All text alignment and direction properties
ā NOT Supported Layout Modes
Float Layout (Legacy)
float: left / float: right - NOT SUPPORTED
clear - NOT SUPPORTED
- Why: Legacy layout model, use Flexbox instead
Table Layout
display: table - NOT SUPPORTED
display: table-row, display: table-cell - NOT SUPPORTED
- Why: Use Flexbox or CSS Grid (when available)
ā³ Coming Soon
CSS Grid
display: grid - Planned
- All grid properties - Planned
- Use Flexbox until Grid is available
ā
Fully Supported CSS Features
Colors & Backgrounds
- All color formats (hex, rgb, rgba, hsl, hsla, named)
background-color, background-image, background-size, etc.
- Linear gradients, radial gradients
Borders & Shapes
border, border-radius, border-color, etc.
box-shadow, text-shadow
Transforms (Hardware Accelerated)
transform: translate(), rotate(), scale(), skew()
- 2D and 3D transforms
- Use for smooth animations
Animations & Transitions
transition - All transition properties
@keyframes and animation
- CSS animations are fully supported
Layout & Sizing
width, height, min-width, max-width, etc.
margin, padding
box-sizing
Responsive Design
@media queries
- Viewport units (
vw, vh, vmin, vmax)
- Some advanced units not supported (
dvh, lvh, svh)
Advanced CSS
- CSS variables (
--custom-property)
- Pseudo-classes (
:hover, :active, :focus, etc.)
- Pseudo-elements (
::before, ::after)
- Filters (
blur, brightness, contrast, etc.)
z-index and stacking contexts
ā ļø Partially Supported
Tailwind CSS
- v3 - ā
Supported (some utilities may not work if they use unsupported features)
- v4 - ā Not yet supported (planned for 2026)
ā NOT Supported CSS Features
backdrop-filter - Not available
- Advanced viewport units -
dvh, lvh, svh
Architecture Differences
Understanding why some features aren't available:
| Aspect | Browser | WebF |
|---|
| Runtime | V8 / SpiderMonkey | QuickJS (ES6+) |
| DOM | Blink / Gecko | Custom C++ + Dart |
| Layout | Browser engine | Flutter rendering |
| Purpose | General web browsing | App runtime |
Key Insight: WebF implements core web standards for building apps, not for web browsing.
Finding Alternatives
For IndexedDB ā Use Native Storage
localStorage.setItem('user', JSON.stringify({ name: 'Alice', age: 30 }));
const user = JSON.parse(localStorage.getItem('user'));
For WebGL ā No Alternative
const ctx = canvas.getContext('2d');
For Float Layout ā Use Flexbox
.sidebar { float: left; width: 200px; }
.content { float: right; width: calc(100% - 200px); }
.container { display: flex; }
.sidebar { width: 200px; flex-shrink: 0; }
.content { flex-grow: 1; }
For Table Layout ā Use Flexbox
.table { display: table; }
.row { display: table-row; }
.cell { display: table-cell; }
.table { display: flex; flex-direction: column; }
.row { display: flex; }
.cell { flex: 1; }
For Native Device Features ā Use WebF Plugins
Check available plugins: https://openwebf.com/en/native-plugins
WebF provides official npm packages for native features. When you need a native feature:
- First, check the available plugins list at https://openwebf.com/en/native-plugins
- Ask the user about their environment before providing setup instructions
- Follow the plugin's installation guide for their specific environment
Step 1: Determine Your Environment
IMPORTANT: Setup differs based on your development environment.
Question: "Are you testing in WebF Go, or working on a production app?"
Option 1: Testing in WebF Go (Most web developers)
- ā
Just install npm package
- ā
No additional setup needed
- Example:
npm install @openwebf/webf-share
Option 2: Production app with Flutter team
- ā ļø Your Flutter developer needs to add the Flutter plugin first
- ā ļø Once they've done that, you install the npm package
- ā ļø Coordinate with your Flutter team - give them the plugin documentation
Example: Native Share Plugin
If using WebF Go:
npm install @openwebf/webf-share
If integrating with Flutter app:
npm install @openwebf/webf-share
Usage in JavaScript:
import { WebFShare } from '@openwebf/webf-share';
if (WebFShare.isAvailable()) {
await WebFShare.shareText({
text: 'Check this out!',
url: 'https://example.com',
title: 'My App'
});
}
import { useWebFShare } from '@openwebf/webf-share';
function ShareButton() {
const { share, isAvailable } = useWebFShare();
if (!isAvailable) return null;
return (
<button onClick={() => share({ text: 'Hello!' })}>
Share
</button>
);
}
Finding the Right Plugin
When looking for native features:
- Check plugin list: https://openwebf.com/en/native-plugins
- If plugin exists: Follow its installation guide
- If no plugin exists:
- For WebF Go users: Feature may not be available
- For Flutter integration: Create custom plugin using WebF Module System
How to Check Compatibility
1. Check the Compatibility Table
See reference.md in this skill for complete compatibility tables.
2. Test in WebF Go
if (typeof IndexedDB !== 'undefined') {
console.log('IndexedDB available');
} else {
console.log('IndexedDB NOT available - use alternative');
}
if (typeof WebF !== 'undefined') {
console.log('Running in WebF');
}
3. Use Feature Detection
function checkStorageOptions() {
const support = {
localStorage: typeof localStorage !== 'undefined',
sessionStorage: typeof sessionStorage !== 'undefined',
indexedDB: typeof indexedDB !== 'undefined'
};
console.log('Storage support:', support);
return support;
}
Common Questions
"Can I use Tailwind CSS?"
Yes, but only v3 - v4 is planned for 2026.
npm install -D tailwindcss@^3.0 postcss autoprefixer
Some Tailwind utilities may not work if they use unsupported CSS features (like float or table layout).
"Why no Web Workers?"
JavaScript in WebF already runs on a dedicated thread, separate from the Flutter UI thread. Web Workers would provide no performance benefit.
"Can I use React Query / SWR / Axios?"
Yes! All popular libraries that use fetch() or XMLHttpRequest work perfectly:
- ā
React Query
- ā
SWR
- ā
Axios
- ā
TanStack Query
- ā
Apollo Client (if using fetch)
"Can I use AI streaming APIs (OpenAI, etc.)?"
Yes! WebF supports both EventSource (SSE) and fetch() streaming, which are the two main approaches used by AI SDKs:
- ā
OpenAI streaming (uses SSE)
- ā
Vercel AI SDK (uses SSE / fetch streaming)
- ā
Any SSE-based streaming API
- ā
EventSource with named events, auto-reconnect, and lastEventId
"What about CSS-in-JS libraries?"
Most work fine as they generate standard CSS:
- ā
styled-components
- ā
Emotion
- ā
CSS Modules
- ā
Sass/SCSS
"Can I use CSS Grid?"
Not yet - it's coming soon. Use Flexbox for now, which handles most layouts.
Debugging Compatibility Issues
If a feature isn't working:
- Check this compatibility guide - Is it supported?
- Test in browser first - Does it work in a regular browser?
- Check for typos - Correct API names?
- Read error messages - WebF provides helpful errors
- Use feature detection - Check if API exists before using
if (typeof fetch !== 'undefined') {
} else {
console.error('fetch not available');
}
Resources
Quick Decision Tree
Need storage?
āā Simple key-value ā localStorage ā
āā Complex database ā Native plugin (sqflite/hive) ā
āā IndexedDB ā ā Not available
Need layout?
āā Flexible layout ā Flexbox ā
āā Grid layout ā Wait for CSS Grid ā³ or use Flexbox
āā Float layout ā ā Use Flexbox instead
āā Table layout ā ā Use Flexbox instead
Need graphics?
āā 2D canvas ā Canvas 2D ā
āā SVG ā SVG ā
āā 3D graphics ā ā WebGL not available
āā Complex graphics ā Flutter rendering ā
Need networking?
āā HTTP requests ā fetch ā
āā Real-time (bidirectional) ā WebSocket ā
āā Real-time (server push) ā EventSource (SSE) ā
āā AI streaming ā EventSource or fetch ā
āā GraphQL ā fetch-based clients ā
Need native features?
āā Share ā @openwebf/webf-share ā
āā Camera ā Native plugin ā
āā Storage ā Native plugin ā
āā Custom ā Flutter team creates plugin ā